SEQ Function

Converts a character to its ASCII code or a string to its decimal value.

Syntax

SEQ(char)

SEQ(string{,size})

Syntax Elements

char is the ASCII character to be converted.

string is a DataBasic expression that evaluates to a string.

size is a positive integer in the range 1 to 6, specifying the size of the character string to be converted.

Comments

SEQ converts the first character, or first size characters, of the string value to its corresponding decimal value.

SEQ may be used to convert binary fields to decimal.

SEQ is the inverse of the CHAR function.

Examples

PRINT SEQ('I')

Prints the number 73.

DIM C(50)
S = 'THE GOOSE FLIES SOUTH'
FOR I=1 TO LEN(S)
C(I) = SEQ(S[I,1])
NEXT I

Places the decimal equivalents of the characters in string S into vector C.

PRINT SEQ('ABCD',3)

Prints the number 4276803, having converted the string 'ABC' (4276803 = 65 * 65536 + 66 * 256 + 67, where 65, 66 and 67 are the ASCII codes representing the characters "A", "B" and "C" respectively).

Go to top button