xHarbour Reference Documentation > Function Reference xHarbour Developers Network  

MLCount()

Counts the number of lines in a character string or memo field

Syntax

MLCount( <cString>   , ;
        [<nLineLen>] , ;
        [<nTabSize>] , ;
        [<lWrap>]    , ;
        [<lLongLines>] ) --> nLineCount

Arguments

<cString>
A character string or memo field to be counted. It can be a formatted text string that includes Tab and Hard/Soft carriage return characters.
<nLineLen>
A numeric value specifying the number of characters per line. It is usually a value between 4 and 254. If <nLineLen> is larger than 254 characters, parameter <lLongLines> must be set to .T. (true). The default value for <nLineLen> is 79.
<nTabSize>
A numeric value specifying the number of blank spaces the Tab character should be expanded to. It defaults to 4 blank spaces.
<lWrap>
A logical value indicating if word wrapping should be applied to <cString> when lines are counted. The default value is .T. (true), resulting in text lines being counted that contain whole words only. When a word does not fit entirely to the end of a text line, it is wrapped to the next text line. Passing .F. (false) for this parameter turns word wrapping off so that only lines ending with a hard carriage return are counted.
<lLongLines>
This parameter defaults to .F. (false). It must be set to .T. (true) when text lines of more than 254 characters should be counted.

Return

The function returns the number of lines contained in <cString> when it is formatted according to the parameters <nLineLen>, <nTabSize> and <lWrap>.

Description

MLCount() is used in conjunction with MemoLine() that extracts single lines of text from a formatted text string or memo field. MLCount() determines the total number of lines that can be extracted from <cString>.

Info

See also:MemoLine(), MemoTran(), MLPos()
Category: Memo functions , Character functions
Source:rtl\txtline.c
LIB:xhb.lib
DLL:xhbdll.dll

Example

// Refer to function MemoLine() for a usage example of MLCount()

Copyright © 2006-2007 xHarbour.com Inc. All rights reserved.
http://www.xHarbour.com
Created by docmaker.exe