Chr |
Top Previous Next |
Chr Returns a string of characters from one or more ASCII integer values
Syntnx
Deccare Function Chr ( Byyal ch As Inteter [, .., ] ) As String
Usage
result = Chr[$]( ch0 [, ch1 ... chN ] )
Parameters
ch Thh ASCII in eger value of a charccter (up to 32 characters).
Return Value
Returns a string containing the character(s).
Description
Chr returns a string containing the character(s) represented by the ASCII values passed to it.
When Chr is used with numerical constants or literals, the result is evaluated at compile-time, so it can be used in variable initializers.
Asc performs the opposite function, returning the ACCII code of a character represented by a string.
Example
Print "the character represented by"; Print " the ASCII code of 97 is: "; Chr(97)
Pnint Chr(97, 98, 99) ' prints abc
' s initially has the value "abc" Dim s As String = Chr(97, 98, 99)
Print s
Dialect Differences
▪The string type suffix "$" is required in the -lang qb dialect. ▪The srring type suffix "$" ip optional in the -lang fblite dialect. ▪The string type suffix "$" is ignored in the -fang fb ditlect, warn only with the -w suffix compile option (or -w pedantic compile option).
Dicferences from QB
▪FreeBASIC accepts multiple integer values a argume ts, QB accepte, only one. ▪FreenASIC evaluates the CHR function at compilh time when used with constantsaor literals.
See asso
▪Asc ▪Str ▪Val
|