intel MCS BASIC-52 — Intel MCS BASIC-52 Versions 1 & 1.1 Operating and Reference Manual PDF (EN)

int e l 6.2 THE ASC OPERATOR In MCS BASIC-52, two operators manipulate STRINGS. These operators are ASC( ) and CHR( ). Ad- mittedly, the string operators contained in MCS BASIC-52 are not quite as powerful as the string operators contained in some BASICS. But surprisingly enough, by using the string operators available in MCS BASIC-52 it is possible to manipulate strings in almost any way imaginable. This in itself is a commendable feat since MCS BASIC-52 was designed primarily to be a sophisticated BASIC language oriented controller, not a string manipulator. The string operators available in MCS BASIC-52 are as follows:

ASC( ) The ASC( ) operator returns the integer value of the ASCII character placed in the parentheses. EXAMPLE: >PRINT ASC(A) 65 65 is the decimal representation for the ASCII character "A." In addition, individual characters in a pre- defined ASCII string can be evaluated with the ASC( ) operator. EXAMPLE: >10 $(1)="THIS IS A STRING" >20 PRINT $(1) >30 PRINT ASC($(1),1) THIS IS A STRING 84 When the ASC( ) operator is used in the manner shown above, the $([expr]) denotes what string is being accessed and the expression after the comma "picks out" an individual character in the string.

In the above example, the first character in the string was picked out and 84 is the decimal representation for the ASCII character " T ." - 83 -