Please enable JavaScript to view this site.

A-Shell Reference

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 Xcall XFOLD.

CHR$(x)

Returns the OEM or Latin1 character—depending on the current character set—corresponding to the value x.

EDIT$()

Returns a modified version of a string based on specified options.

FILL$()

Returns a string consisting of a string repeated until it reaches specified length.

INSTR()

Returns position of first occurrence of a specified string.

.INSTRR()

Same as INSTR() but works in reverse direction.

.ISEMPTY()

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].

LEN()

Returns length of specified string.

LSTRIP$(a$)

Returns the string a$ with the leading blanks and TABs removed. Also see TRIM$(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].

NUMEXPR()

Treats expression as numeric.

ODTIM$()

Outputs the specified date and/or time according to the formatting flags.

PAD$()

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. Also see STRIP$(a$) and TRIM$(a$)

SPACE$(x)

Returns a string of x spaces. Also see FILL$().

STREXPR$()

Treats the expression argument as a string.

STRIP$(a$)

Returns the string a$ with the trailing spaces and tabs removed.

STR$()

Convert a numeric value or expression to string. Also see RTRIM$(a$) above and STRIP.

TRIM$(a$)

Returns the string a$ with the leading spaces and tabs removed; equivalent to the combination of STRIP$(a$) and LSTRIP$(a$). Also see the subroutine TRIM.

UCS$(a$)

Returns string a$ folded to upper case.

VAL()

Returns the decimal value of a string.

.VALX()

Extended version of VAL.

 

History

2024 May, A-Shell 7.0.1757: Refinement to the SPACE() function: remove the 64K limitation on the length of the returned string. SPACE(n) now maps to FILL$(chr(32),n); its theoretical maximum length is 2GB.

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$)