BrightSign HD2000 BrightScript Reference Guide User Manual

Page 25

Advertising
background image

25

MID (string, p, [n])

Returns a substring of string with length n and starting at position p. n may be omitted, in which case the
string starting at p and ending at the end of the string is returned. The first character in the string is poison 1
Example:

PRINT MID(“Timothy”, 4,3) ‘prints oth

RIGHT (string, n)

Returns the last n characters of string. Example:

RIGHT$(ST$,4) returns the last 4 characters of ST$.

ReadAsciiFile(filepath)

This function reads the specified file and returns it as a string. For example:

text=DoReadAsciiFile(“/config.txt”)

STR (expression)

Converts a numeric expression or constant to a string. STR$(A), for example, returns a string equal to the
character representation of the value of A. For example, if A=58.5, then STR$(A) equals the string " 58.5".
(Note that a leading blank is inserted before "58.5" to allow for the sign of A).

STRING (n, "character" or number)

Returns a string composed of n character-symbols. For example,

STRING $(30,"*")
returns "******************************"

VAL (string)

Performs the inverse of the STR$ function: returns the number represented by the characters in a string
argument. The numerical type of the result can be integer, float, or double precision, as determined by the
rules for the typing of constants. For example, if A$="12" and B$="34" then VAL(A$+ "."+B$) returns the
value 12.34.

20 INPUT "ENTER MESSAGE"; M$
30 FOR K=1 TO LEN(M$)
40 T$=MID(M$, K, 1 )
60 CD=ASC(T$)+5: IF CD>255 CD=CD-255
70 NU$=NU$ + CHR(CD)
80 NEXT
90 PRINT "THE CODED MESSAGE IS"
100 PRINT NU$
110 FOR K=1 TO LEN(NU$)
120 T$=MID(NU$, K, 1)
130 CD=ASC(T$)-5: IF CD < 0 CD=CD+255

Advertising
This manual is related to the following products: