StrLeft
Use this function to extract the leftmost character or characters from a symbol or character string.
You may find the StrLeft function useful for finding individual values from a combined value.
For example, suppose a complete account number in your system appears in the format A11234 — consisting of a prefix code (A), followed by two digits (11) representing an entity code, followed by three digits (234) representing an account code.
You can use the StrLeft function to find the prefix code (the leftmost character) from the complete account number.
Syntax:
STRLEFT ("String",NumChars)
where:
- "String" is a character string, enclosed in double quotation marks.
- NumChars is a positive integer representing the number of characters to extract from the beginning of the character string. NumChars cannot be greater than the number of characters in the character string.
Syntax example:
CodeLet = STRLEFT("A11234",1)
Code example:
CREATE VARIABLE StrTemp1 AS STRINGSET VARIABLE StrTemp1 = STRLEFT ("StringTest",6)
//StrTemp1 will equal "String" (without the double quotation marks)