Built-in string functions – BrightSign HD2000 BrightScript Reference Guide User Manual
Page 24

24
Built-in String Functions
ASC
MID
CHR
RIGHT
INSTR
STR
INKEY
STRING
LEN
VAL
LEFT READASCIIFILE
ASC (string)
Returns the ASCII code (in decimal form) for the first character of the specified string. . A null-string
argument will cause an error to occur. Example:
100 PRINT ASC("A")
CHR (expression)
Performs the inverse of the ASC function: returns a one-character string whose character has the specified
ASCII, or control. Example:
PRINT CHR$(35) ‘
prints a number-sign #
Using CHR$, you can assign quote-marks (normally used as string-delimiters) to strings. The ASCII code for
quotes - is 34. So A$=CHR$(34) assigns the value " to A$.
INSTR(position to start, text-to-search, substring-to-find)
Returns the position of a substring within a string. Returns 0 if the substring is not found.
The first position is 1. For example:
PRINT INSTR(1, “This is a test”, “is”)
will print 3
LEFT (string, n)
Returns the first n characters of string.
PRINT LEFT$(“Timothy”, 3) ‘ displays Tim
LEN (string)
Returns the character length of the specified string. Example:
PRINT LEN(“Timothy”) ‘ prints 7