Updated May 2023
"True string functions" are those that return string values. Such functions can usually be specified with or without a trailing $ (i.e., CHR(X) or CHR$(X); we use the trailing $ below to emphasize that the function acts like a string expression. Also included here are functions that return numeric values (and thus are really numeric functions) but whose purpose is closely tied to string handling, such as LEN().
Note that for the functions below without links to further description, a$ is used to indicate a string, while x and y are used for numeric arguments; in all cases those arguments could be either variables or expressions. For the linked functions, follow the links for details on the argument lists.
Function |
Description |
ASC(a$) |
Returns numeric value of first character of a$. |
AUTOCAP$(a$) |
Intelligently capitalizes a$. The A-Shell implementation of this is rather minimal; users in need of more "intelligent" capitalization should refer to XFOLD.SBR. |
CHR$(x) |
Returns the OEM or Latin1 character—depending on the current character set—corresponding to the value x. |
Returns a modified version of a string based on specified options. |
|
Returns a string consisting of a string repeated until it reaches specified length. |
|
Returns position of first occurrence of a specified string. |
|
Same as INSTR() but works in reverse direction. |
|
Returns yes/no if the string or unformatted expression is "empty. |
|
LCS$(a$) |
Returns string a$ folded to lower case. |
LEFT$(a$,x) |
Returns leftmost x characters of string a$. Equivalent to a$[1,x]. |
Returns length of specified string. |
|
LSTRIP$(a$) |
Strips leading blanks from a$. Syntax: LSTRIP(a$) or LSTRIP$(a$). |
MID$(a$,x,y) |
Returns substring of a$, starting in position x and extending y characters or until end. Equivalent to substring syntax a$[x;y]. |
Treats expression as numeric. |
|
Outputs the specified date and/or time according to the formatting flags. |
|
Returns string truncated, or padded with trailing blanks, to the specified length. |
|
RIGHT$(a$,x) |
Returns the rightmost x characters of string a$. Equivalent to a$[-x,-1]. |
RTRIM$(a$) |
Returns string a$ with trailing spaces removed. |
SPACE$(x) |
Returns a string of x spaces. Also see FILL$(). |
Treats the expression argument as a string. |
|
STRIP$(a$) |
Same as RTRIM$(a$). |
Convert a numeric value or expression to string. |
|
TRIM$(a$) |
TRIM(a$) or TRIM$(a$) removes the leading and trailing blanks from a string; equivalent to the combination of STRIP$(a$) and LSTRIP$(a$). Besides offering the advantage of functional syntax, as a built-in function, TRIM$() is more efficient than the equivalent XCALL TRIM, although the latter offers the option to remove characters besides blanks. |
UCS$(a$) |
Returns string a$ folded to upper case. |
Returns the decimal value of a string. |
|
Extended version of VAL. |
History
2022 March, A-Shell 6.5.1713, compiler edit 977: Add TRIM.
2022 March, A-Shell 6.5.1712, compiler edit 971: Add LSTRIP.
2021 June, A-Shell 6.5.1704, compiler edit 947: all standard string functions now support the optional $ suffix on the name (e.g. STR(x) or STR$(x).) The following functions did not previously support the optional $ suffix: AUTOCAP$(a$), LCS$(a$), ODTIM$(), RTRIM$(a$), UCS$(a$)