STRING

Name

STRING -- 

Function

<sResString>        ADDSLASHES(<sString>)
cTrimString         ALLTRIM(<cString>)
nCode               ASC(<cExp>)
nPosition           AT(<cSearch>, <cTarget>)
TRUE || FALSE       BETWEEN(<TargetData>, <FirstData>, <SecondData>)
cResult             bUnZip2(<cData>)
cResult             bZip2(<cData> [,<nLevel>])
cChar               CHR(<nCode>)
<nCount>            CSCOUNT(<ÓChar>, <sString>)
<nValue>            DSTRTON(<sString>)
lEmpty              EMPTY(<exp>)
<nValue>            FSTRTON(<sString>)
nPos                FT_AT2( <cSearch>, <cTarget> [, <nOccurs> [, <lCaseSens> ] ] )
cByte               FT_BITCLR( <cByte>, <nBitPos> )
cByte               FT_BITSET( <cByte>, <nBitPos> )
cByte               FT_BYTEAND( <cByte1>, <cByte2> )
cNewByte            FT_BYTENEG( <cByte> )
cNewByte            FT_BYTENOT( <cByte> )
cNewByte            FT_BYTEOR( <cByte1>, <cByte2> )
cNewByte            FT_BYTEXOR( <cByte1>, <cByte2> )
<nStringPosition>   FT_FINDITH( <cCheckFor>, <cCheckIn>, <nWhichOccurrence> ; [, <lIgnoreCase> ] )
lResult             FT_ISBIT( <cByte>, <nBitPos> )
lResult             FT_ISBITON( <nNumber>, <nBit> )
cMetaPhone          FT_METAPH( <cName> [, <nSize> ] )
<nOccurrences>      FT_NOOCCUR( <cCheckFor>, <cCheckIn> ; [, <lIgnoreCase> ] )
<cPrinterFormat>    FT_PCHR( <cString> )
TRUE || FALSE       GLOB(<sString>, <sReg>, [<lIgnoreCase>])
cResult             gUnZip(<cData>)
cResult             gZip(<cData> [,<nLevel>])
cConvertedString    HARDCR(<cString>)
<sStr>              HASHNAME(<nHashCode>)
<nHashCode>         HASHSTR(<sStr>)
lBoolean            ISALPHA(<cString>)
lBoolean            ISDIGIT(<cString>)
lBoolean            ISLOWER(<cString>)
lBoolean            ISUPPER(<cString>)
cSubString          LEFT(<cString>, <nCount>)
nCount              LEN(<cString> | <aTarget>)
TRUE || FALSE       LIKE(<sMask>, <sString>)
cLowerString        LOWER(<cString>)
cTrimString         LTRIM(<cString>)
cTextBuffer         MEMOEDIT([<cString>], [<nTop>], [<nLeft>], [<nBottom>], [<nRight>], [<lEditMode>], [<cUserFunction>], [<nLineLength>], [<nTabSize>], [<nTextBufferRow>], [<nTextBufferColumn>], [<nWindowRow>], [<nWindowColumn>])
cLine               MEMOLINE(<cString>,[<nLineLength>],[<nLineNumber>], [<nTabSize>],[<lWrap>])
cString             MEMOREAD(<cFile>)
cNewString          MEMOTRAN(<cString>,[<cReplaceHardCR>],[<cReplaceSoftCR>])
lSuccess            MEMOWRIT(<cFile>, <cString>)
nLines              MLCOUNT(<cString>, [<nLineLength>],[<nTabSize>], [<lWrap>])
nPosition           MLCTOPOS(<cText>, <nWidth>, <nLine>, <nCol>, [<nTabSize>], [<lWrap>])
nPosition           MLPOS(<cString>, <nLineLength>, <nLine>, [<nTabSize>], [<lWrap>])
aLineColumn         MPOSTOLC(<cText>, <nWidth>, <nPos>, [<nTabSize>], [<lWrap>])
cPaddedString       PADL(<exp>, <nLength>, [<cFillChar>]) --> cPaddedString PADC(<exp>, <nLength>, [<cFillChar>]) --> cPaddedString PADR(<exp>, <nLength>, [<cFillChar>])
NIL                 QOUT([<exp list>]) --> NIL QQOUT([<exp list>])
nPosition           RAT(<cSearch>, <cTarget>)
cRepeatedString     REPLICATE(<cString>, <nCount>)
cSubString          RIGHT(<cString>, <nCount>)
cTrimString         [R]TRIM(<cString>)
TRUE || FALSE       SEARCH(<sPattern>, <sString>, [@aReg], [<nFrom>], [<nRange>])
cSoundexString      SOUNDEX(<cString>)
cSpaces             SPACE(<nCount>)
cNumber             STR(<nNumber>, [<nLength>], [<nDecimals>])
<vData>             STR2VAR(<sUucodeStr>)
cNewString          STRTRAN(<cString>, <cSearch>,[<cReplace>], [<nStart>], [<nCount>])
cNewString          STUFF(<cString>, <nStart>,	<nDelete>, <cInsert>)
cSubstring          SUBSTR(<cString>, <nStart>, [<nCount>])
cFormatString       TRANSFORM(<exp>, <cSayPicture>)
cTrimString         TRIM(<cString>)
cType               TYPE(<cExp>)
cUpperString        UPPER(<cString>)
nNumber             VAL(<cNumber>)
cType               VALTYPE(<exp>)
<sUucodeStr>        VAR2STR(<vData>)
<nCode>             WEIGHTASC(<sString>)
<sTable>            WEIGHTTABLE()

Description

Function ADDSLASHES()

  ADDSLASHES(<sString>) 	--> <sResString>
 

ADDSLASHES() returns a string <sResString> with backslashes before characters that need to be quoted in database queries etc. These characters are single quote ('), double quote ("), backslash (\) and NUL (the null byte).

Function ALLTRIM()

 ALLTRIM(<cString>) --> cTrimString

ALLTRIM() is a character function that removes both leading and trailing spaces from a string. It is related to LTRIM() and RTRIM() which remove leading and trailing spaces, respectively. The inverse of ALLTRIM(), LTRIM(), and RTRIM() are the PADC(), PADL(), and PADR() functions which center, left-justify, or right-justify character strings by padding them with fill characters.

Function ASC()

 ASC(<cExp>) --> nCode

ASC() is a character conversion function that returns the ASCII value of the leftmost character in a character string. ASC() is used primarily on expressions requiring numeric calculations on the ASCII value of a character. CHR() and ASC() are inverse functions.

Function AT()

 AT(<cSearch>, <cTarget>) --> nPosition

AT() is a character function used to determine the position of the first occurrence of a character substring within another string. If you only need to know whether a substring exists within another string, use the $ operator. To find the last instance of a substring within a string, use RAT().

Function BETWEEN()

 BETWEEN(<TargetData>, <FirstData>, <SecondData>) 	--> TRUE || FALSE

BETWEEN() compares source value <TargetData> with <FirstData> and <SecondData>. If <TargetData> locate between <FirstData> and <SecondData>, BETWEEN() returns TRUE.

All values must be ones type (string, numeric, date, ...).

Function CHR()

 CHR(<nCode>) --> cChar

CHR() is a numeric conversion function that converts an ASCII code to a character. It is the inverse of ASC(). CHR() serves a number of common tasks including:

Sending control codes and graphics characters to the screen or printer

Ringing the bell

Converting INKEY() return values to characters

Stuffing the keyboard buffer

Function CSCOUNT()

 CSCOUNT(<ÓChar>, <sString>) 	--> <nCount>

CSCOUNT() returns the number of character <cChar> into source string <sString>.

Function DSTRTON()

 DSTRTON(<sString>) 	--> <nValue>

DSTRTON() converts string <sString> to numeric values and returns it.

Function FSTRTON()

 FSTRTON(<sString>) 	--> <nValue>

FSTRTON() converts string <sString> to numeric values and returns it.

Function FT_AT2()

 FT_AT2( <cSearch>, <cTarget> [, <nOccurs> [, <lCaseSens> ] ] ) --> nPos

This function will find the nth occurrence of a substring within a string.

Function FT_BITCLR()

 FT_BITCLR( <cByte>, <nBitPos> ) --> cByte

In effect, ANDs argument byte with a byte that has all bits set except the target bit. If bit is already clear (0), it remains clear. Note: Calls FT_ISBIT() which is also in this Library.

This function is presented to illustrate that bit-wise operations are possible with Clipper code. For greater speed, write .C or .ASM versions and use the Clipper Extend system.

Function FT_BITSET()

 FT_BITSET( <cByte>, <nBitPos> ) --> cByte

In effect, ORs argument byte with a byte that has only the target bit set. If bit is already set, it remains set. Note: Calls FT_ISBIT() which is also in this Library.

This function is presented to illustrate that bit-wise operations are possible with Clipper code. For greater speed, write .C or .ASM versions and use the Clipper Extend system.

Function FT_BYTEAND()

 FT_BYTEAND( <cByte1>, <cByte2> ) --> cByte

Can be used for any bit-wise masking operation. In effect, this is a bit-by-bit AND operation. Equivalent to AND assembler instruction.

This function is presented to illustrate that bit-wise operations are possible with Clipper code. For greater speed, write .C or .ASM versions and use the Clipper Extend system.

Function FT_BYTENEG()

 FT_BYTENEG( <cByte> ) --> cNewByte

Can be used for bit-wise byte manipulation. In effect, this is a bit-by-bit NEG (two's complement) operation. Equivalent to NEG assembler instruction.

This function is presented to illustrate that bit-wise operations are possible with Clipper code. For greater speed, write .C or .ASM versions and use the Clipper Extend system.

Function FT_BYTENOT()

 FT_BYTENOT( <cByte> ) --> cNewByte

Can be used for bitwise byte manipulation. In effect, this is a bit-by-bit NOT (one's complement) operation. Equivalent to the NOT assembler instruction.

This function is presented to illustrate that bit-wise operations are possible with Clipper code. For greater speed, write .C or .ASM versions and use the Clipper Extend system.

Function FT_BYTEOR()

 FT_BYTEOR( <cByte1>, <cByte2> ) --> cNewByte

Can be used for bit-wise byte manipulation. In effect, this is a bit-by-bit OR operation. Equivalent to OR assembler instruction.

This function is presented to illustrate that bit-wise operations are possible with Clipper code. For greater speed, write .C or .ASM versions and use the Clipper Extend system.

Function FT_BYTEXOR()

 FT_BYTEXOR( <cByte1>, <cByte2> ) --> cNewByte

Can be used for bit-wise byte manipulation. In effect, this is a bit-by-bit XOR operation. Equivalent to XOR assembler instruction.

This function is presented to illustrate that bit-wise operations are possible with Clipper code. For greater speed, write .C or .ASM versions and use the Clipper Extend system.

Function FT_FINDITH()

 FT_FINDITH( <cCheckFor>, <cCheckIn>, <nWhichOccurrence> ;
 [, <lIgnoreCase> ] ) --> <nStringPosition>

This function finds the position in a string of the "ith" time another string appears in it.

Function FT_ISBIT()

 FT_ISBIT( <cByte>, <nBitPos> ) --> lResult

Tests for status of any selected bit in the byte passed as a parameter. Byte must be presented in CHR() form, as a literal constant, or as the one-byte character result of an expression.

This function is presented to illustrate that bit-wise operations are possible with Clipper code. For greater speed, write .C or .ASM versions and use the Clipper Extend system.

Function FT_ISBITON()

 FT_ISBITON( <nNumber>, <nBit> ) --> lResult

This function is useful when dealing with binary integers. It will come in very handy if you use the FT_INT86() function, because the CPU flags are returned as a series of bits. Using this function, you can determine the state of each CPU flag.

Function FT_METAPH()

 FT_METAPH( <cName> [, <nSize> ] ) --> cMetaPhone

This function is a character function use to index and search for sound-alike or phonetic matches. It is an alternative to the SOUNDEX() function, and addresses some basic pronunciation rules, by looking at surrounding letters to determine how parts of the string are pronounced. FT_METAPH() will group sound-alikes together, and forgive shortcomings in spelling ability.

Function FT_NOOCCUR()

 FT_NOOCCUR( <cCheckFor>, <cCheckIn> ;
 [, <lIgnoreCase> ] )     --> <nOccurrences>

This function finds the number of times a string occurs in a second string.

Function FT_PCHR()

 FT_PCHR( <cString> ) -->  <cPrinterFormat>

This function is useful for allowing the user to enter printer control codes in text (enclosed in double quotes), numeric, hexadecimal, or Epson commands preceded by a slash and returns the printer control code equivalent.

NOTES"

- Combinations of text, numbers, hex, and commands must be separated by commas ("A",27,&1B,/RESET). - Text must be enclosed in double quotes ("x"). - Hexadecimal must be preceded by an ampersand (&1B). - Epson commands, listed below, must be preceded by a forward slash (/RESET).

Epson commands: (slash commands are specific to the Epson)

Job Control:

/RESET or /INIT Reset or initialize the printer /BELL or /BEEP Cause the printer's speaker to beep (not HS) /CAN Clear print buffers (not MX) /SLOW Set low speed mode (not CR, HS, MX) /FAST Cancel low speed mode (not CR, HS, MX) /ONE Select Unidirectional mode /TWO Select Directional mode /ON Activate printer /OFF Turn off printer

/FF or /EJECT Form Feed

Page Control:

/1/6 Set 6 lines per inch /1/8 Set 8 lines per inch /SKIP Set Skip perforation ON /SKIPOFF Set Skip perforation OFF

Font Selection and Manipulation:

/ITALIC Select italic char. set (only FX86, EX, LX, no LQ-1500, SX) /GRAPHIC Select graphic char. set (only FX86, EX, LX, no LQ-1500, SX) /ROMAN Choose Roman font /SANS Choose Sans Serif font /DRAFT Choose draft /NLQ Choose near letter quality /PICA Choose 10 chars per inch /ELITE Choose 12 chars per inch /COND or /SI Choose 15 chars per inch /EMPH Turn emphasize on /EMPHOFF Turn emphasize off /SPANISH Select spanish international char set /USA Select USA international char set

Function GLOB()

 GLOB(<sString>, <sReg>, [<lIgnoreCase>]) 	--> TRUE || FALSE

GLOB() returns TRUE if string corresponding to regular expression. The expression <sReg> is the simple regular expression by DOS rules.

Function HARDCR()

 HARDCR(<cString>) --> cConvertedString

HARDCR() is a memo function that replaces all soft carriage returns (CHR(141)) with hard carriage returns (CHR(13)). It is used to display long character strings and memo fields containing soft carriage returns with console commands. In xClipper, console commands (including REPORT and LABEL FORM) do not automatically convert soft carriage returns to hard carriage returns, making it necessary for you to explicitly make the conversion. Soft carriage returns are added by MEMOEDIT() when lines wrap.

Function HASHNAME()

  HASHNAME(<nHashCode>) 	--> <sStr>
 

HASHNAME() returns sources string for hash code <nHashCode>.

Function HASHSTR()

 HASHSTR(<sStr>) 	--> <nHashCode>

HASHSTR() calulates hash code from string <sStr> and returns it as numeric value <nHashCode>. Hash code has unique values into range of 1000000 to MAX_LONG.

Function ISALPHA()

 ISALPHA(<cString>) --> lBoolean

ISALPHA() is a character function that determines if the specified string begins with an alphabetic character. An alphabetic character consists of any uppercase or lowercase letter from A to Z. ISALPHA() returns false (.F.) if the string begins with a digit or any other character.

Function ISDIGIT()

 ISDIGIT(<cString>) --> lBoolean

ISDIGIT() is a character function that determines whether the first character in a string is a numeric digit between zero and nine. If any other character is the first character of the <cString>, ISDIGIT() returns false (.F.).

ISDIGIT() is useful where you need to know if the current character string is a number before converting it to a numeric value with the VAL() function.

Function ISLOWER()

 ISLOWER(<cString>) --> lBoolean

ISLOWER() is a character function that determines whether the first character of a character string is lowercase. It is the inverse of ISUPPER() which determines whether a character begins with an uppercase character.

Both ISLOWER() and ISUPPER() relate to the LOWER() and UPPER() functions which actually convert lowercase characters to uppercase, and vice versa.

Function ISUPPER()

 ISUPPER(<cString>) --> lBoolean

ISUPPER() is a character function that determines whether the first character of a string is uppercase. It is the inverse of ISLOWER(). Both ISUPPER() and ISLOWER() relate to the UPPER() and LOWER() functions which actually convert uppercase characters to lowercase, and vice versa.

Function LEFT()

 LEFT(<cString>, <nCount>) --> cSubString

LEFT() is a character function that returns a substring of a specified character string. It is the same as SUBSTR(<cString>, 1, <nCount>). LEFT() is also like RIGHT(), which returns a substring beginning with the last character in a string.

LEFT(), RIGHT(), and SUBSTR() are often used with both the AT() and RAT() functions to locate the first and/or the last position of a substring before extracting it.

Function LIKE()

 LIKE(<sMask>, <sString>) 	--> TRUE || FALSE

LIKE() returns TRUE if string corresponding to mask. The string <sMask> can contents special symbols: <?>, <*>, <.>

Function LOWER()

 LOWER(<cString>) --> cLowerString

LOWER() is a character function that converts uppercase and mixed case strings to lowercase. It is related to UPPER() which converts lowercase and mixed case strings to uppercase. LOWER() is related to the ISLOWER() and ISUPPER() functions which determine whether a string begins with a lowercase or uppercase letter.

LOWER() is generally used to format character strings for display purposes. It can, however, be used to normalize strings for case- independent comparison or INDEXing purposes.

Function LTRIM()

 LTRIM(<cString>) --> cTrimString

LTRIM() is a character function that formats character strings with leading spaces. These can be, for example, numbers converted to character strings using STR().

LTRIM() is related to RTRIM(), which removes trailing spaces, and ALLTRIM(), which removes both leading and trailing spaces. The inverse of ALLTRIM(), LTRIM(), and RTRIM() are the PADC(), PADR(), and PADL() functions which center, right-justify, or left-justify character strings by padding them with fill characters.

Function MEMOEDIT()

 MEMOEDIT([<cString>],
 [<nTop>], [<nLeft>],
 [<nBottom>], [<nRight>],
 [<lEditMode>],
 [<cUserFunction>],
 [<nLineLength>],
 [<nTabSize>],
 [<nTextBufferRow>],
 [<nTextBufferColumn>],
 [<nWindowRow>],
 [<nWindowColumn>]) --> cTextBuffer

<cString>

is the character string or memo field to copy to the MEMOEDIT() text buffer. If not specified, the text buffer is empty.

<nTop>

, <nLeft>, <nBottom>, and <nRight> are the upper-left and lower-right window coordinates. Row values can range from zero to MAXROW(), and column positions can range from zero to MAXCOL(). If not specified, the default coordinates are 0, 0, MAXROW(), and MAXCOL().

<lEditMode>

determines whether the text buffer can be edited or merely displayed. Specifying true (.T.) allows the user to make changes to the text buffer, while specifying false (.F.) only allows the user to browse the text buffer. If not specified, the default value is true (.T.).

<cUserFunction>

is the name of a user-defined function that executes when the user presses a key not recognized by MEMOEDIT() and when no keys are pending in the keyboard buffer. <cUserFunction> is specified as a character value without parentheses or arguments. Specifying false (.F.) for this argument displays <cString> and causes MEMOEDIT() to immediately terminate. If this argument is specified, the automatic behavior of MEMOEDIT() changes. Refer to the discussion below.

<nLineLength>

determines the length of lines displayed in the MEMOEDIT() window. If a line is greater than <nLineLength>, it is word wrapped to the next line in the MEMOEDIT() window. If <nLineLength> is greater than the number of columns in the MEMOEDIT() window, the window will scroll if the cursor moves past the window border. If

<nLineLength>

is not specified, the default line length is (<nRight> -

<nLeft>

).

<nTabSize>

determines the tab stops that will be used when the user presses Tab. If <nTabSize> is not specified, tab stops will be placed at every four characters.

<nTextBufferRow>

and <nTextBufferColumn> define the display position of the cursor within the text buffer when MEMOEDIT() is invoked. <nTextBufferRow> begins with one (1) and <nTextBufferColumn> begins with zero (0). If these arguments are not specified, the cursor is placed at row one (1) and column zero (0) of the MEMOEDIT() window.

<nWindowRow>

and <nWindowColumn> define the initial position of the cursor within the MEMOEDIT() window. Row and column positions begin with zero (0). If these arguments are not specified, the initial window position is row zero (0) and the current cursor column position.

Returns :

MEMOEDIT() returns the text buffer if the user terminates editing with Ctrl+W or a copy of <cString> if user terminates with Esc.

See also : LASTKEY() MEMOLINE() MEMOREAD() MEMOTRAN() MEMOWRIT()

Function MEMOLINE()

 MEMOLINE(<cString>,[<nLineLength>],[<nLineNumber>],
 [<nTabSize>],[<lWrap>]) --> cLine

MEMOLINE() is a memo function used with MLCOUNT() to extract lines of text from character strings and memo fields based on the number of characters per line. It is the most basic facility provided by xClipper to display memo fields and long strings.

The basic method of operation is to determine the number of lines in the memo field or character string using MLCOUNT() with the same number of characters per line, tab size, and wrapping behavior as you intend to use with MEMOLINE(). Using this value as the upper boundary of a FOR...NEXT, each line of the memo field or character string can be extracted with MEMOLINE() and processed with any combination of output commands and functions required.

<cString>

is the memo field or character string from which a line of text is to be extracted.

<nLineLength>

specifies the number of characters per line and can be between four and 254. If not specified, the default line length is 79.

<nLineNumber>

is the line number to be extracted. If not specified, the default value is one.

<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 :

MEMOLINE() returns the line of text specified by <nLineNumber> in <cString> as a character string. If the line has fewer characters than the indicated length, the return value is padded with blanks. If the line number is greater than the total number of lines in <cString>, MEMOLINE() returns a null string (""). If <lWrap> is true (.T.) and the indicated line length breaks the line in the middle of a word, that word is not included as part of the return value but shows up at the beginning of the next line extracted with MEMOLINE(). If <lWrap> is false (.F.), MEMOLINE() returns only the number of characters specified by the line length. The next line extracted by MEMOLINE() begins with the character following the next hard carriage return, and all intervening characters are not processed.

See also : MEMOEDIT() MLCOUNT() MLPOS()

Function MEMOREAD()

 MEMOREAD(<cFile>) --> cString

MEMOREAD() is a memo function that reads a disk file into memory where it can be manipulated as a character string or assigned to a memo field. MEMOREAD() is used with MEMOEDIT() and MEMOWRIT() to edit an imported disk file, and then write it back to disk. MEMOREAD() searches for <cFile> beginning with the current DOS directory. If the file is not found, MEMOREAD() searches the DOS path. MEMOREAD() does not use the xClipper DEFAULT or PATH to search for <cFile>.

In a network environment, MEMOREAD() attempts to open the specified file shared and read--only. If the file is opened exclusive by another process, MEMOREAD() returns a null string ("").

Function MEMOTRAN()

 MEMOTRAN(<cString>,[<cReplaceHardCR>],[<cReplaceSoftCR>]) --> cNewString

MEMOTRAN() is a memo function that converts a memo field or long character string containing hard and soft carriage return/line feed characters into a form that can be displayed. These two character combinations are end of line formatting indicators placed in the string by MEMOEDIT(). Soft carriage returns (CHR(141)) are inserted when a line longer than the width of the MEMOEDIT() window wraps. Hard carriage returns (CHR(13)) are inserted when the user explicitly presses Return.

MEMOTRAN() is particularly useful when displaying a memo field in a REPORT FORM which does not wrap when a soft carriage return is encountered. MEMOTRAN() resolves this by converting soft carriage returns to spaces. Note, however, that you must declare MEMOTRAN() as external using the REQUEST statement if it is used in a REPORT FORM and not specified anywhere else in the current program.

Function MEMOWRIT()

 MEMOWRIT(<cFile>, <cString>) --> lSuccess

MEMOWRIT() is a memo function that writes a character string or memo field to a disk file. If a path is not specified, MEMOWRIT() writes <cFile> to the current DOS directory and not the current DEFAULT directory. If <cFile> already exists, it is overwritten.

MEMOWRIT() is generally used with MEMOREAD() to load text files into memory where they can be edited, displayed, and written back to disk. You can also use MEMOWRIT() as a quick way of exporting a memo field to a text file.

Function MLCOUNT()

 MLCOUNT(<cString>, [<nLineLength>],[<nTabSize>], [<lWrap>]) --> nLines

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.

Function MLCTOPOS()

 MLCTOPOS(<cText>, <nWidth>, <nLine>, <nCol>, [<nTabSize>], [<lWrap>]) --> nPosition

MLCTOPOS() is a memo function that determines the byte position that corresponds to a particular line and column within the formatted text. Note that the line number is one-relative and the column number is zero-relative. This is compatible with MEMOEDIT(). The return value is one-relative, making it suitable for use in SUBSTR() or other string functions.

Function MLPOS()

 MLPOS(<cString>, <nLineLength>, <nLine>, [<nTabSize>], [<lWrap>]) --> nPosition

Function MPOSTOLC()

 MPOSTOLC(<cText>, <nWidth>, <nPos>, [<nTabSize>], [<lWrap>]) --> aLineColumn

MPOSTOLC() is a memo function that determines the formatted line and column corresponding to a particular byte position within <cText>. Note that the line number returned is one-relative and the column number is zero-relative. This is compatible with MEMOEDIT(). <nPos> is one-relative, compatible with AT(), RAT(), and other string functions.

Function PAD()

 PADL(<exp>, <nLength>, [<cFillChar>]) --> cPaddedString
 PADC(<exp>, <nLength>, [<cFillChar>]) --> cPaddedString
 PADR(<exp>, <nLength>, [<cFillChar>]) --> cPaddedString

PADC(), PADL(), and PADR() are character functions that pad character, date, and numeric values with a fill character to create a new character string of a specified length. PADC() centers <exp> within <nLength> adding fill characters to the left and right sides; PADL() adds fill characters on the left side; and PADR() adds fill characters on the right side. If the length of <exp> exceeds <nLength>, all of the PAD() functions truncate cPaddedString to <nLength>.

PADC(), PADL(), and PADR() display variable length strings within a fixed length area. They can be used, for instance, to ensure alignment with consecutive ?? commands. Another use is to display text to a fixed- width screen area assuring that previous text is completely overwritten.

PADC(), PADL(), and PADR() are the inverse of the ALLTRIM(), RTRIM(), and LTRIM() functions which trim leading and trailing space from character strings.

Function RAT()

 RAT(<cSearch>, <cTarget>) --> nPosition

RAT() is a character function that returns the position of the last occurrence of a character substring within another character string. It does this by searching the target string from the right. RAT() is like the AT() function, which returns the position of the first occurrence of a substring within another string. RAT() is also like the $ operator, which determines whether a substring is contained within a string.

Both the RAT() and AT() functions are used with SUBSTR(), LEFT(), and RIGHT() to extract substrings.

Function REPLICATE()

 REPLICATE(<cString>, <nCount>) --> cRepeatedString

REPLICATE() is a character function that repeatedly displays, prints, or stuffs the keyboard with one or more characters. REPLICATE() is like the SPACE() function, which returns a specified number of space characters.

Function RIGHT()

 RIGHT(<cString>, <nCount>) --> cSubString

RIGHT() is a character function that extracts a substring beginning with the rightmost character in <cString>. It is the same as the character expression, SUBSTR(<cString>, <nCount>). For example, RIGHT("ABC", 1) is the same as SUBSTR("ABC", -1). RIGHT() is related to LEFT(), which extracts a substring beginning with the leftmost character in <cString>.

The RIGHT(), LEFT(), and SUBSTR() functions are often used with both the AT() and RAT() functions to locate either the first and/or the last position of a substring before extracting it.

Function RTRIM()

 [R]TRIM(<cString>) --> cTrimString

RTRIM() is a character function that formats character strings. It is useful when you want to delete trailing spaces while concatenating strings. This is typically the case with database fields which are stored in fixed-width format. For example, you can use RTRIM() to concatenate first and last name fields to form a name string.

RTRIM() is related to LTRIM() which removes leading spaces, and ALLTRIM() which removes both leading and trailing spaces. The inverse of ALLTRIM(), LTRIM(), and RTRIM() are the PADC(), PADR(), and PADL() functions which center, right-justify, or left-justify character strings by padding them with fill characters. RTRIM() is exactly the same as TRIM() in function.

Function SEARCH()

 SEARCH(<sPattern>, <sString>, [@aReg], [<nFrom>], [<nRange>]) --> TRUE || FALSE

SEARCH() searches substring into string <sString> by regular expression <sPattern> begin with position <nFrom> and in range <nRange>. The result of search will be wrote to <aReg> if this parameter specified.

<nRange> it is the shifting value, when will be checked concidence about <nFrom>. If <nRange>==0 - checked only position <nFrom>; if <nRange>==1 - checked positions <nFrom> and <nFrom>+1; if <nRange>==-1 - checked positions <nFrom> and <nFrom>-1.

Every element <aReg> is the array of 3 elementes: 1-st element - is the starting position founded substring; 2-d element - is the end founded substring; 3-d element - is the substring length.

Function SOUNDEX()

 SOUNDEX(<cString>) --> cSoundexString

SOUNDEX() is a character function that indexes and searches for sound- alike or phonetic matches. It is used in applications where the precise spelling of character keys is not known or where there is a high probability of misspelled names. Misspelling is common in real-time transaction systems where the data entry operator is receiving information over the telephone. SOUNDEX() works by bringing sound-alikes together under the same key value. Note, however, the soundex method is not absolute. Keys that are quite different can result in the same soundex value.

Function SPACE()

 SPACE(<nCount>) --> cSpaces

SPACE() is a character function that returns a specified number of spaces. It is the same as REPLICATE("", <nCount>). SPACE() can initialize a character variable before associating it with a GET. SPACE() can also pad strings with leading or trailing spaces. Note, however, that the PADC(), PADL(), and PADR() functions are more effective for this purpose.

Function STR()

 STR(<nNumber>, [<nLength>], [<nDecimals>]) --> cNumber

STR() is a numeric conversion function that converts numeric values to character strings. It is commonly used to concatenate numeric values to character strings. STR() has applications displaying numbers, creating codes such as part numbers from numeric values, and creating index keys that combine numeric and character data.

STR() is like TRANSFORM(), which formats numeric values as character strings using a mask instead of length and decimal specifications.

The inverse of STR() is VAL(), which converts character numbers to numerics.

Function STR2VAR()

 STR2VAR(<sUucodeStr>) 	--> <vData>

STR2VAR() deconverts uucode string <sUucodeStr> to source data <vData> to uucode string and returns it. This function is conversely for VAR2STR() function.

Function STRTRAN()

 STRTRAN(<cString>, <cSearch>,[<cReplace>], [<nStart>], [<nCount>]) --> cNewString

STRTRAN() is a character function that performs a standard substring search within a character string. When it finds a match, it replaces the search string with the specified replacement string. All instances of <cSearch> are replaced unless <nStart> or <nCount> is specified. Note that STRTRAN() replaces substrings and, therefore, does not account for whole words.

Function STUFF()

 STUFF(<cString>, <nStart>,	<nDelete>, <cInsert>) --> cNewString

STUFF() is a character function that deletes <nDelete> characters from <cString> beginning at the <nStart> position. Then, it inserts <cInsert> into the resulting string beginning at <nStart> to form the return string. With this, STUFF() can perform the following six operations:

Insert: If <nDelete> is zero, no characters are removed from <cString>. <cInsert> is then inserted at <nStart>, and the entire string is returned. For example, STUFF("My dog has fleas.", 12, 0, "no" ) returns "My dog has no fleas."

Replace: If <cInsert> is the same length as <nDelete>, <cInsert> replaces characters beginning at <nStart>. The same number of characters are deleted as are inserted, and the resulting string is the same length as the original. For example, STUFF("My dog has fleas.", 12, 5, "bones") returns "My dog has bones."

Delete: If <cInsert> is a null string (""), the number of characters specified by <nDelete> are removed from <cString>, and the string is returned without any added characters. For example, STUFF("My dog has fleas.", 1, 3, "") returns "dog has fleas."

Replace and insert: If <cInsert> is longer than <nDelete>, all characters from <nStart> up to <nDelete> are replaced and the rest of <cInsert> is inserted. Since more characters are inserted than are deleted, the resulting string is always longer than the original. For example, STUFF("My dog has fleas.", 8, 3, "does not have") returns "My dog does not have fleas."

Replace and delete: If the length of <cInsert> is less than <nDelete>, more characters are deleted than inserted. The resulting string, therefore, is shorter than the original. For example, STUFF("My dog has fleas.", 8, 3, "is") returns "My dog is fleas."

Replace and delete rest: If <nDelete> is greater than or equal to the number of characters remaining in <cString> beginning with <nStart>, all remaining characters are deleted before <cInsert> is inserted. For example, STUFF("My dog has fleas.", 8, 10, "is.") returns "My dog is."

Function SUBSTR()

 SUBSTR(<cString>, <nStart>, [<nCount>]) --> cSubstring

SUBSTR() is a character function that extracts a substring from another character string or memo field. SUBSTR() is related to the LEFT() and RIGHT() functions which extract substrings beginning with leftmost and rightmost characters in <cString>, respectively.

The SUBSTR(), RIGHT(), and LEFT() functions are often used with both the AT() and RAT() functions to locate either the first and/or the last position of a substring before extracting it. They are also used to display or print only a portion of a character string.

Function TRIM()

 TRIM(<cString>) --> cTrimString

TRIM() is a character function that formats character strings. It is useful when you want to delete trailing spaces while concatenating strings. This is typically the case with database fields which are stored in fixed-width format. For example, you can use TRIM() to concatenate first and last name fields to form a name string.

TRIM() is related to LTRIM(), which removes leading spaces, and ALLTRIM(), which removes both leading and trailing spaces. The inverse of ALLTRIM(), LTRIM(), and RTRIM() are the PADC(), PADR(), and PADL() functions which center, right-justify, or left-justify character strings by padding them with fill characters.

Function UPPER()

 UPPER(<cString>) --> cUpperString

UPPER() is a character function that converts lowercase and mixed case strings to uppercase. It is related to LOWER() which converts uppercase and mixed case strings to lowercase. UPPER() is related to the ISUPPER() and ISLOWER() functions which determine whether a string begins with an uppercase or lowercase letter.

UPPER() is generally used to format character strings for display purposes. It can, however, be used to normalize strings for case- independent comparison or INDEXing purposes.

Function VAL()

 VAL(<cNumber>) --> nNumber

VAL() is a character conversion function that converts a character string containing numeric digits to a numeric value. When VAL() is executed, it evaluates <cNumber> until a second decimal point, the first non-numeric character, or the end of the expression is encountered. Leading spaces are ignored. When SET FIXED is ON, VAL() returns the number of decimal places specified by SET DECIMALS, rounding <cNumber> if it is specified with more digits than the current DECIMALS value. As with all other functions that round, digits between zero and four are rounded down, and digits between five and nine are rounded up. When SET FIXED is OFF, VAL() returns the number of decimal places specified in <cNumber>.

VAL() is the opposite of STR() and TRANSFORM(), which convert numeric values to character strings.

Function VAR2STR()

 VAR2STR(<vData>) 	--> <sUucodeStr>

VAR2STR() converts source data <vData> to uucode string <sUucodeStr> and returns it.