String Functions

"True string functions" are those that return string values. Such functions can 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 that return numeric values (and thus are really numeric functions) but whose purpose is closely tied to string handling, such as LEN().

Function

Description

ASC(a$)

Returns ASCII value (in decimal) of first character of a$. 

AUTOCAP(var)

"Intelligently" capitalizes the specified string. Note that 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 ASCII character corresponding to the value x.

EDIT$

Returns a modified version of the string a$, based on option bits set in flags.

FILL$

Returns a string consisting of the string a$ repeated until it reaches n bytes long. Requires COMPIL switch /X:1 or higher.

INSTR()

Returns position of first occurrence of pattern$ in source.

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 string a$.

MID$(a$,start,length)

Returns substring of a$, starting in position start and extending length characters (or until end). Equivalent to substring syntax a$[start;length].

ODTIM

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

PAD

Returns string a$ truncated, or padded with trailing blanks as necessary to be exactly x characters long.

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(X,N).

STRIP(a$)

Same as RTRIM(a$). (Plus extension.)

STR$(x)

Returns the string decimal representation of the value x, with no leading or trailing blanks.

UCS$(a$)

Returns string a$ folded to upper case.

VAL(a$)

Returns numeric value of the decimal representation in the string a$. Supports "hexadecade" date notation if OPTIONS=HEXDEC (which see for more information). Also supports the decimal point and thousands separator character definitions in the Language Definition File. A-Shell extension