MLCOUNT() Count the number of lines in a character string or memo field ------------------------------------------------------------------------------ Syntax MLCOUNT(<cString>, [<nLineLength>], [<nTabSize>], [<lWrap>]) --> nLines Arguments <cString> is the character string or memo field to be counted. <nLineLength> specifies the number of characters per line and can range from four to 254. If not specified, the default line length is 79. <nTabSize> defines the tab size. If not specified, the default value is four. If <nTabSize> is greater than or equal to <nLineLength>, then the tab size is automatically converted to <nLineLength> - 1. <lWrap> toggles word wrap on and off. Specifying true (.T.) toggles word wrap on; false (.F.) toggles it off. If not specified, the default value is true (.T.). Returns MLCOUNT() returns the number of lines in <cString> depending on the <nLineLength>, the <nTabSize>, and whether word wrapping is on or off. Description MLCOUNT() is a memo function used with MEMOLINE() to print character strings and memo fields based on the number of characters per line. In the basic operation, use MLCOUNT() to return the number of lines in the character string or memo field. Then, using MEMOLINE() to extract each line, loop through the memo field until there are no lines left. If <lWrap> is true (.T.) and an end of line position breaks a word, it is word wrapped to the next line and the next line begins with that word. If <lWrap> is false (.F.), MLCOUNT() counts the number of characters specified by <nLineLength> as the current line. The next line begins with the character following the next hard or soft carriage return. Intervening characters are ignored. Examples . This example displays the contents of each Notes memo field in the Sales database file, one line at a time: USE Sales NEW nLineLength = 65 // DO WHILE !EOF() nLines = MLCOUNT(Sales->Notes, nLineLength) FOR nCurrLine = 1 TO nLines ? MEMOLINE(Sales->Notes, nLineLength, nCurrLine) NEXT SKIP ? ENDDO Files Library is EXTEND.LIB.
See Also: MEMOLINE() MEMOTRAN() MLPOS()
Pingback: C5_TEXT | Viva Clipper !