Functions included in this section are listed below. Click a link to jump to that function.
General Information
$ Function
ALLTRIM( ) Function
ASC( ) Function
AT( ) Function
AT_C( ) Function
ATC( ) Function
ATCC( ) Function
CHR( ) Function
CHRTRAN( ) Function
CHRTRANC( ) Function
CTOBIN( ) Function
CURVAL( ) Function
GETPEM( ) Function
LEFT( ) Function
LEFTC ( ) Function
LEN( ) Function
LENC( ) Function
LOWER( ) Function
LTRIM( ) Function
MAX( ) Function
MIN( ) Function
OCCURS( ) Function
OEMTOANSI( ) Function
OLDVAL( ) Function
PEMSTATUS( ) Function
PADC( ) Functions
PADL( ) Functions
PADR( ) Functions
PROPER( ) Function
RAT( ) Function
RATC( ) Function
REPLICATE( ) Function
RIGHT( ) Function
RIGHTC( ) Function
RTRIM( ) Function
SOUNDEX( ) Function
SPACE( ) Function
STR( ) Function
STRCONV( ) Function
STRTRAN( ) Function
STUFF( ) Function
STUFFC( ) Function
SUBSTR( ) Function
SUBSTRC( ) Function
TRANSFORM( ) Function
TRIM( ) Function
TYPE( ) Function
UPPER( ) Function
"text" | Enclose text in quotes. |
+ | Performs character string concatenation. String 2 is added to string 1.
A = "Hello, " B = "Joe" A + B = "Hello, Joe" |
- | Removes trailing spaces from String 1 and adds them to end of string 2
A - B = "Hello,Joe " |
Purpose | Returns true (.T.) if a character expression is contained in another character expression; otherwise returns false (.F.).
If the character expression isn't found, false (.F.) is returned |
||||||
Syntax | <expC1> $ <expC2> | ||||||
Returns | Logical: .T. or .F. | ||||||
Parameter | <expC1> Search string
<expC2> String to be searched |
||||||
Remarks | If <expC1> is found in <expC2>, .T. is returned. If <expC1> isn't found in <expC2>, .F. is returned. This function is case sensitive (upper- and lower-case are respected). | ||||||
Examples |
|
Purpose | Removes leading and trailing blanks from the specified character expression and returns the trimmed expression as a character string. This function can be used to ensure that blanks are removed from data entered by a user. | ||||
Syntax | ALLTRIM(<expC>) | ||||
Returns | Returns the specified character expression with leading and trailing blanks removed. | ||||
Parameter | <expC> Leading and trailing blanks are removed from the character expression <expC>. | ||||
Examples |
|
Purpose | Returns the ASCII code equivalent of the first character in a character expression. | ||
Syntax | ASC(<expC>) | ||
Returns | Numeric | ||
Parameter | <expC) The ASCII code equivalent is returned for the first character in the character expression <expC>. Any characters after the first character are ignored. | ||
Examples |
|
Purpose | Returns the beginning numeric position of the first occurrence of a character expression or memo field within another character expression or memo field, counting from the leftmost character | ||
Syntax | AT(<expC1>, <expC2>[, <expN>]) | ||
Returns | Numeric | ||
Parameter | <expC1>, <expC2> FoxPro looks for the search character expression <expC1> in the second character expression <expC2>. The character expressions <expC1> and <expC2> can be of any size. If <expN> is included, AT( ) searches for the <expN>the occurrence of <expC1> in <expC2>. By default, AT( ) searches for the first occurrence of <expC1> (<expN> = 1). Including <expN> lets you search for additional occurrences of <expC1> in <expC2>. | ||
Remarks | AT( ) searches the second character expression for the first occurrence of the first character expression. It then returns an integer indicating the position of the first character in the found character expression. If the character expression isn't found, 0 is returned. The search performed by AT( ) is case sensitive (upper and lower-case is respected). To perform a search that isn't case sensitive, use ATC( ). | ||
Examples |
|
This function is not used in TAM.
Purpose | Returns the beginning numeric position of the first occurrence of a character expression or memo field within another character expression or memo field, without regard for the case of these two expressions. | ||
Syntax | ATC(<expC1>, <expC2>[, <expN>]) | ||
Returns | Numeric | ||
Parameter | <expC1>, <expC2> ATC( ) searches <expC2> for <expC1>. The character expressions <expC1> and <expC2> can be fields of any size.
<expN> If <expN> is included, ATC( ) searches for the <expN>The occurrence of <expC1> in <expC2>. By default, ATC( ) searches for the first occurrence of <expC1> (<expN> = 1). Including <expN> lets you search for additional occurrences of <expC1> in <expC2>. |
||
Remarks | ATC( ) searches the second character expression for the occurrence of the first character expression, without concern for the case (upper or lower) of the characters in either expression. Use AT( ) to perform a case-sensitive search.
ATC( ) returns an integer corresponding to the position where the first character of the character expression is found. If the character expression isn't found, 0 is returned. |
||
Examples |
|
This function is not used in TAM.
Purpose | Returns the character associated with the specified numeric ASCII code | ||
Syntax | CHR(<expN>) | ||
Returns | Character | ||
Parameter | Include in CHR( ) a numeric expression <expN> that evaluates to a number in the range of 0 to 255. The numeric expression is evaluated and the equivalent ASCII character is returned. Use ASC( ) to return the ASCII code for a specified character. CHR( ) returns a single character corresponding to a numeric expression. CHR( ) can be used to send printer control codes to a printer. | ||
Examples |
|
Purpose | Replaces each character in a character expression that matches a character in a second character expression with the corresponding character in a third character expression. | ||||||
Syntax | CHRTRAN(<expC1>, <expC2>, <expC3>) | ||||||
Returns | Character | ||||||
Parameter | <expC1>, <expC2>, <expC3>
If a character from <expC1> is found in <expC2>, the character in <expC1> is replaced by the character from <expC3> that's in the same position in <expC3> as is the character in <expC2>. If <expC3> has fewer characters than <expC2>, the additional characters in <expC2> are translated to null characters. If <expC3> has more characters than <expC2>, the additional characters are ignored. |
||||||
Examples |
|
This function is not used in TAM.
Purpose | Converts a binary character representation to an integer value |
Syntax | CTOBIN(<expC>) |
Returns | Numeric |
Parameter | <expC> <expC> specifies the binary character representation to convert |
Remarks | Use CTOBIN( ) to convert a binary character representation created with BINTOC( ) back to its integer value. |
This function is not used in TAM.
This function is not used in TAM.
Purpose | Returns a specified number of characters from a character expression, starting with the leftmost character. | ||||
Syntax | LEFT(<expC>, <expN>) | ||||
Returns | Character | ||||
Parameter | <expC> Characters are returned from the character expression specified with <expC>.
<expN> The number of characters returned from the character expression is specified with <expN>. If <expN> is greater than the length of <expC>, all of the character expression is returned. The null string is returned if <expN> is negative or 0. |
||||
Examples |
|
This function is not used in TAM.
Purpose | Returns the number of characters in a character expression. |
Syntax | LEN(<expC>) |
Returns | Numeric |
Parameter | <expC> <expC> is the character expression whose length you want to determine |
Examples | LEN(pol_idx) If pol_idx is ABBOJO1-3001, it returns 12. |
This function is not used in TAM.
Purpose | Returns a specified character expression in lower-case letters. | ||||
Syntax | LOWER(<expC>) | ||||
Returns | Character | ||||
Parameter | <expC> is the character expression you want to convert to lower-case. | ||||
Examples |
|
Purpose | Returns the specified character expression with leading blanks removed.
LTRIM( ) returns a character string that results from removing the leading blanks from a character expression. This function is especially useful for removing the leading blanks that are inserted when you use STR( ) to convert a numeric value to a character string. |
||
Syntax | LTRIM(<expC>) | ||
Returns | Character | ||
Parameter | <expC> Include the character expression <expC> from which you want to trim the leading blanks. | ||
Examples |
|
Purpose | Returns the expression with the highest ASCII or numeric value or the latest date from a list of character, numeric or date expressions. | ||||||||
Syntax | MAX(<expr1>, <expr2>[, <expr3> ... ]) | ||||||||
Returns | Character, Date or Numeric | ||||||||
Parameter | <expr1>, <expr2>[, <expr3> ... ] <expr1>, <expr2>, and <expr3> are the set of expressions from which you want MAX( ) to return the expression with the highest value.
All the expressions must be of the same type (character, numeric or date). |
||||||||
Examples |
|
Purpose | Returns the expression with the lowest ASCII or numeric value or the earliest date in a list of character, numeric or date expressions. | ||||||||
Syntax | MIN(<expr1>, <expr2>[, <expr3> ...]) | ||||||||
Returns | Character, Date or Numeric | ||||||||
Parameter | <expr1>, <expr2>[, <expr3> ...] <expr1>, <expr2>, and <expr3> are the set of expressions from which you want MIN( ) to return the expression with the lowest value. All the expressions must be of the same type (character, numeric or date). | ||||||||
Remarks | MIN( ) (minimum) evaluates a set of numeric expressions and returns the expression with the smallest value. When determining the minimum date value from a set of dates, MIN( ) returns the earliest date.
MIN( ) returns the character expression with the minimum ASCII value from a set of character expressions. |
||||||||
Examples |
|
Purpose | Returns the number of times the value of a character expression occurs within another character expression. | ||
Syntax | OCCURS(<expC1>, <expC2>) | ||
Returns | Numeric | ||
Parameter | <expC1> Include a character expression <expC1> for which to search.
<expC2> The second character expression <expC2> is searched for occurrences of the first character expression <expC1>. OCCURS( ) returns zero if the value of an expression isn't found in the value of another expression. |
||
Examples |
|
This function is not used in TAM.
This function is not used in TAM.
This function is not used in TAM.
Purpose | Returns the specified expression padded on the left, right, or both left and right sides. | ||||||||
Syntax | PADL(<expr>, <expN>[, <expC>])
PADR(<expr>, <expN>[, <expC>]) PADC(<expr>, <expN>[, <expC>]) These functions return a character string from a character expression, padded to a specified length. PADL( ) inserts padding on the left, PADR( ) inserts padding on the right and PADC( ) inserts padding on both sides. |
||||||||
Returns | Character | ||||||||
Parameter | <expr> Include the expression <expr> to be padded. This expression can be a character, numeric or date expression.
<expN> specifies the total number of characters in the expression after it is padded. <expC> The value of <expC> is used for padding. If <expC> is omitted, spaces (ASC(32)) are used for padding. If <expC> is included, the value of <expC> is repeated as necessary to pad the expression <expr> to a length of <expN> characters. |
||||||||
Examples |
|
Purpose | Returns the specified character expression with each word having the initial letter capitalized and the remaining characters lowercase. PROPER( ) returns from a character expression a character string capitalized as appropriate for proper names. | ||
Syntax | PROPER(<expC>) | ||
Returns | Character | ||
Parameter | <expC> A properly capitalized character string is returned from the character expression <expC> you specify. | ||
Examples |
|
Purpose | Returns the beginning numeric position of the first occurrence of one character expression or memo field within another character expression or memo field, counting from the rightmost character. | ||
Syntax | RAT(<expC1>, <expC2>[, <expN>]) | ||
Returns | Numeric | ||
Parameter | <expC1>, <expC2> RAT( ) looks for <expC1> in <expC2>. <expC1> and <expC2> can be memo fields.
<expN> Include <expN> to specify which occurrence of <expC1> in <expC2> to look for. By default, RAT( ) searches for the first occurrence of <expC1> (<expN> = 1). If <expN> is included, RAT( ) searches for the <expN>th occurrence of <expC1> in <expC2>. 0 is returned if <expN> is higher than the number of times <expC1> occurs in <expC2>. |
||
Remarks | RAT( ), the reverse AT( ) function, searches a character expression, starting with the last character in the expression, for the occurrence of another character expression. It then returns an integer corresponding to the position where the first character in the character expression is found. 0 is returned if the character expression isn't found.
The search performed by RAT( ) is case sensitive; upper-case and lower-case are respected. |
||
Examples |
|
This function is not used in TAM.
Purpose | Returns a character string that contains a specified character expression repeated a specified number of times. |
Syntax | REPLICATE(<expC>, <expN>) |
Returns | Character |
Parameter | <expC> The character expression that is replicated is specified in <expC>.
<expN> The character expression is replicated <expN> times. |
Remarks | The maximum length of the resulting character string cannot exceed 64,000 characters in the Standard version of FoxPro for MS-DOS. In the 32-bit Extended version of FoxPro for MS-DOS and in FoxPro for Windows, the maximum length of the resulting character string is restricted by the amount of available memory. |
Examples | REPLICATE(*^,4) Returns: *^*^*^*^ |
Purpose | Returns the specified number of rightmost characters from a character string. | ||||
Syntax | RIGHT(<expC>, <expN>) | ||||
Returns | Character | ||||
Parameter | <expC> Rightmost characters are returned from the character expression specified in <expC>.
<expN> The number of characters returned from the character expression is specified by <expN>. All of the character expression is returned if <expN> is greater than the length of <expC>. The null string is returned if <expN> is negative or 0. Characters are returned beginning with the last character on the right and continuing for a specified number of characters. |
||||
Examples |
|
This function is not used in TAM.
Purpose | Returns the specified character expression with all trailing blanks removed. |
Syntax | RTRIM(<expC>) |
Returns | Character |
Parameter | <expC> Include the character expression <expC> to trim the trailing blanks from.
RTRIM( ) returns a character string that results from removing the trailing blanks from a character expression. RTRIM( ) is identical to TRIM( ). |
Examples | RTRIM(city) If city is 'Chicago ', it returns 'Chicago'. |
Purpose | Returns a phonetic representation of the specified character expression. | ||||
Syntax | SOUNDEX(<expC>) | ||||
Returns | Character | ||||
Parameter | <expC> Specify the character expression SOUNDEX( ) evaluates with <expC>. | ||||
Remarks | SOUNDEX( ) returns a four-character string. By comparing the results SOUNDEX( ) returns for two character expressions, you can determine if the two expressions are phonetically similar, indicating that they sound alike. This can be useful when searching for duplicate records in a table/.DBF.
SOUNDEX( ) isn't case sensitive and generally disregards vowels. |
||||
Examples |
|
Purpose | Returns a character string composed of a specified number of spaces. |
Syntax | SPACE(<expN>) |
Returns | Character |
Parameter | <expN> Specify the number of spaces returned by SPACE( ) with <expN>. |
Examples | SPACE(10) Returns: 10 spaces |
Purpose | Returns the character string equivalent to a specified numeric expression. | ||||
Syntax | Syntax: STR(<expN1>[, <expN2>[, <expN3>]]) | ||||
Returns | Character | ||||
Parameter | <expN1> The numeric expression evaluated by STR( ) is specified by <expN1>.
<expN2> The length of the character string returned by STR( ) is specified with <expN2>. The length includes one character for the decimal point and one character for each digit to the right of the decimal point. STR( ) pads the character string with leading spaces if you specify a length larger than the number of digits left of the decimal point. STR( ) returns a string of asterisks, indicating numeric overflow, if you specify a length less than the number of digits left of the decimal point. <expN3> The number of decimal places in the character string returned by STR( ) is specified by the numeric expression <expN3>. You must include <expN2> to specify the number of decimal places. If you specify fewer decimal places than are in the numeric expression <expN1>, the extra digits are truncated. |
||||
Examples |
|
This function is not used in TAM.
Purpose | Searches a character expression or memo field for occurrences of a second character expression or memo field, and then replaces each occurrence with a third character expression or memo field.
You can specify where the replacement begins and how many replacements are made. STRTRAN( ) returns the resulting character string. |
||||
Syntax | STRTRAN(<expC1>, <expC2>[, <expC3>] [, <expN1>] [, <expN2>]) | ||||
Returns | Character | ||||
Parameter | <expC1> The character expression that's searched is specified with <expC1>. <expC1> can be a memo field.
<expC2> The character expression that's searched for in <expC1> is specified with <expC2>. The search is case-sensitive (lower-case and upper-case are respected). <expC2> can be a memo field. <expC3> The search character expression <expC2> is replaced in <expC1> by the character expression <expC3>. If <expC3> is omitted, <expC2> is replaced with the null string. <expN1> The optional numeric expression <expN1> specifies which occurrence of <expC2> is the first to be replaced. For example, if <expN1> is 4, replacement begins with the fourth occurrence of <expC2> in <expC1>, counting from the left, and the first three occurrences of <expC2> remain unchanged. The occurrence where replacement begins defaults to 1 if <expN1> is omitted. <expN2> specifies the number of occurrences of <expC2> to replace. If <expN2> is omitted, all occurrences of <expC2>, starting with the occurrence specified in <expN1>, are replaced. |
||||
Examples |
|
Purpose | Returns a character string created by replacing a specified number of characters in a character expression with another character expression. | ||||||||||||||||||
Syntax | STUFF(<expC1>, <expN1>, <expN2>, <expC2>) | ||||||||||||||||||
Returns | Character | ||||||||||||||||||
Parameter | <expC1> Specify the character expression <expC1> in which the replacement occurs.
<expN1> specifies the position in <expC1> where the replacement begins. <expN2> The number of characters to be replaced is specified by <expN2>. If <expN2> is 0, the replacement string <expC2> is inserted into <expC1>. <expC2> The replacement character expression is specified by <expC2>. If <expC2> is the null string, the number of characters specified by <expN2> are removed from <expC1>. |
||||||||||||||||||
Examples |
|
This function is not used in TAM.
Purpose | Returns a specified number of characters from the given character expression or memo field.
This function extracts and returns characters from a character expression, starting at a specified position in the character expression and continuing for a specified number of characters. |
||||||
Syntax | SUBSTR(<expC>, <expN1>[, <expN2>]) | ||||||
Returns | Character | ||||||
Parameter | <expC> The character expression from which characters are extracted is specified by <expC>. The expression <expC> can be a memo field.
<expN1> The position in the character expression <expC> where character extraction begins is specified by <expN1>. The first character of <expC> is position 1. <expN2> Specifies the number of characters to extract from <expC>. If <expN2> is omitted, characters are extracted until the end of the character expression is reached. |
||||||
Examples |
|
This function is not used in TAM.
Purpose | Formats character or numeric expressions using PICTURE and FUNCTION codes available for @ ... SAY.
TRANSFORM( ) returns a character string in a format determined by a character expression containing the format codes. |
||||||||||||||||||||||||||||||||||||||||||||||||||||
Syntax | TRANSFORM(<expr>, <expC>) | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Returns | Character | ||||||||||||||||||||||||||||||||||||||||||||||||||||
Parameter | <expr> Specify the numeric or character expression to format with <expr>.
<expC> is one or more format codes that specify how the expression is formatted.
If you omit <expC> format codes, Visual FoxPro performs a default transformation on <expr>. The following table describes the transformation performed for each data type <expr> can assume:
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
Examples | TRANSFORM(amt,$$$$$$$$$.99) If amt is 5566776.00, it returns $5566776.00. |
Purpose | Returns the specified character expression with all trailing blanks removed. |
Syntax | TRIM(<expC>) |
Returns | Character |
Parameter | <expC> Specifies the character expression from which TRIM( ) removes all trailing blanks. |
Remarks | TRIM( ) is identical to RTRIM( ). |
Examples | TRIM(city) If city is Chicago , it returns Chicago. |
Purpose | Returns the data type of the specified memo field or character, numeric, logical or date expression. | ||||||||||||||
Syntax | TYPE(<expC>) | ||||||||||||||
Returns | Character | ||||||||||||||
Parameter | <expC> Is the name of a memo field or a character expression. TYPE( ) evaluates the contents of <expC> and returns the appropriate data type. | ||||||||||||||
Remarks | The following table lists the characters TYPE( ) returns and their corresponding data types:
|
||||||||||||||
Examples | TYPE(date) Returns: D |
Purpose | Returns the specified character expression in upper-case.
Each lower-case letter (az) in the character expression is converted to upper-case (AZ) in the returned string. All other characters remain unchanged. |
Syntax | UPPER(<expC>) |
Returns | Character |
Parameter | <expC> Is the character expression you want to convert to upper-case. |
Examples | UPPER(name) If name is Mark K Smith, it returns MARK K SMITH. |
|