Global string functions – BrightSign BrightScript 2 Reference Guide User Manual

Page 38

Advertising
background image

38

Global String Functions

UCase(s As String) As String

Converts the string to all upper case.

LCase(s As String) As String

Converts the string to all lower case.

Asc (letter As String) As Integer

Returns the ASCII code for the first character of the specified string. . A null-string
argument will cause an error to occur. Example:

print asc("a")

Chr (ch As Integer) As String

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 As Integer, text-to-search As String,

substring-to-find As String) As Integer

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 (s As String, n As Integer) As String

Returns the first n characters of s.

print left(“timothy”, 3) „ displays tim

Len (s As String) As Integer

Returns the character length of the specified string. Example:

print len(“timothy”) „ prints 7

Advertising