ASCII Function

コマンド

$ASCII(STRING)

$ASCII(STRING,INTEGER)

Description

$A[SCII] is a function that will return the ASCII integer equivalent (in decimal) of the character at a particular position in a string.

For the one argument form, the INTEGER position used is 1.

For the two argument form, the expression in the second argument is interpreted is truncated to an integer. i.e. as if the expression had were integer divided by 1. (ie: expression1 )

If the string is of zero length, or in the case of the two argument form, where the position in the string corresponding to the INTEGER is less than 1 or larger than the length of the string, the $ASCII intrinsic function returns -1

>WRITE $ASCII("A")
65

>WRITE $ASCII($CHAR(9))
9

>WRITE $ASCII("ABC",3)
67

>WRITE $ASCII("ABC",2.5)
66

Portablity

The M[UMPS] Standard requires that characters with ASCII code values between 0 and 127 be supported. Any characters beyond this range are dependent upon the M[UMPS] implementor. If the character is out of the range supported by the implementor, the value -1 is returned.

Errors/Exceptions

There is no standard M[UMPS] error generated by the $ASCII function.

Table Of Contents

Previous topic

Functions

Next topic

CHAR Function

This Page

inserted by FC2 system