``

prev Menu next

String Functions ☆

Let a$, b$ be string expressions, a, m be numeric expressions below.

Functions of which the result is a number

LEN(a$) | The length of s$, the number of characters a$ contains.
POS(a$,b$) | The position of first occurrence of b$ within a$. If no occurrence, the value is 0.
POS(a$,b$,m) | The position of first occurrence of b$ within the m-th or latter characters of a$ .
VAL(a$) | The value of a numeric a$ represents. Leading and trailing spaces are ignored. If a$ does not represent a number correctly, VAL(a$) causes an exception.
ORD(a$) | If a$ consists of a single character, the value is the character code of it. And ORD("CR")=13, ORD("LF")=10, ORD("HT")=9, etc.

Fuctions of which the result is a string

REPEAT$(a$,m) | The string consisting of m copies of a$.
STR$(a) | The string a is displayed as. No leading or trailing spaces are included.
USING$(a$,x) | The string representing x using a$ as a format item. Format is common with PRINT USING. a$ can not hold extra characters except a format.
CHR$(m) | The character whose character code is m.
LCASE$(a$) | The string on which upper case letters are converted to the lower case.
UCASE$(a$) | The string on which lower case letters are converted to the upper case.
LTRIM$(a$) | The string from which all leading spaces are removed.
RTRIM$(a$) | The string from which all trailing spaces are removed.
DATE$ | The date of the form "yyyymmdd"
TIME$ | The time of the form "hh:mm:ss"

(Supplementary)
On the complex mode or the rational mode, if a number is converted to a string using STR$, and converted back to a numeric using VAL, it may be changed.