String functions

String functions

 

COPY(S,StartPos,[Optional count])

MID(S,StartPos,[Optional count])

SUBSTR(S,Startpos,[Optional count])

These functions return a characters from the given source string s. Parameter s specifies the character expression from which the character string is returned. StartPos specifies the position in the character expression from where the character string is returned. The first character of s is position 1. If StartPos is greater than the number of characters in source string, the empty string is returned. Optional count specifies the number of characters to return from string. If you omit count, characters are returned until the end of the source string is reached.

 

STR(Number,[Length, Decimals])

Returns the character equivalent of a specified numeric expression. Number specifies the numeric expression STR( ) evaluates. Length specifies the length of the character string STR( ) returns. 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 it returns with leading spaces if you specify a length larger than the number of digits to the left of the decimal point. STR( ) doesn,t cut a string, if you specify a length less than the number of digits. If Length isn't included, the length of the character string is number of actual digits in source numeric expression.

Decimals specifies the number of decimal places in the character string STR( ) returns. If you specify fewer decimal places than are in numeric expression, the return value is rounded up. If Decimals isn't included, the number of decimal places defaults to zero.

If Length set to 0, but the same time decimals is not zero, result string is trimmed with trim() function.

 

POS(Substr, S)

Pos searches for Substr within S and returns an integer value that is the index of the first character of Substr within S. Pos is case-sensitive. If Substr is not found, Pos returns zero.

 

VAL(s) - Converts the string value s to its numeric representation. If s is not a valid number, exception is raised.

 

UPPER(s) - Returns the specified character expression in uppercase.

 

LOWER(s) - Returns the specified character expression in lowercase.

 

TRIM(s) - Returns the specified character expression with all trailing blanks removed.