☜ | $ASCIIM[UMPS] by Example | ☞ |
Introduced in the 1977 ANSI M[UMPS] language standard.
This function returns the internal code number for a character in
a string.
The standard defines a one-to-one correspondence between the
codes 0 through 127 and the characters from the (7-bit) ASCII
set. Code numbers >127 are character-set-specific; code numbers
<0 do not indicate valid characters. The special value –1
indicates a reference to a character that does not occur in the
string that is passed as the first parameter.
Assume that X="ABCDE"
Reference | Value | Remarks |
---|---|---|
$ASCII(X) | 65 | |
$ASCII(X,1) | 65 | "A" |
$ASCII(X,2) | 66 | "B" |
$ASCII(X,3) | 67 | "C" |
$ASCII(X,0) | –1 | no character there... |
$ASCII(X,6) | –1 | no character there... |
$ASCII(X,–2) | –1 | no character there... |
$ASCII(X,1.92) | 65 | "A" in position 1 |
Assume that X=""
Reference | Value | Remarks |
---|---|---|
$ASCII(X) | –1 | no character there... |
$ASCII(X,N) | –1 | no character there... |
Assume that X="AB"
Reference | Value | Remarks |
---|---|---|
$ASCII(X,0) | –1 | no character there... |
$ASCII(X,3) | –1 | no character there... |
$ASCII(X,–7) | –1 | no character there... |
$ASCII(X,1.92) | 65 | 1.92 truncates to 1 |
Examples with naked references:
$ASCII(VALUE)
Set ^ABC(1,2)="reset naked indicator"
; naked indicator is now ^ABC(1,
Set ^(3,4)=$ASCII(^(5,6))
; 1. fetch ^(5,6) = ^ABC(1,5,6)
; 2. store ^(3,4) = ^ABC(1,5,3,4)
; naked indicator is now: ^ABC(1,5,3,
$ASCII(VALUE,POS)
Set ^ABC(1,2)="reset naked indicator"
; naked indicator is now ^ABC(1,
Set ^(3,4)=$ASCII(^(5,6),^(7,8))
; 1. fetch ^(5,6) = ^ABC(1,5,6)
; 2. fetch ^(7,8) = ^ABC(1,5,7,8)
; 3. store ^(3,4) = ^ABC(1,5,7,3,4)
; naked indicator is now: ^ABC(1,5,7,3,
Copyright © Standard Documents; 1977-2024 MUMPS Development Committee;
Copyright © Examples: 1995-2024 Ed de Moel;
Copyright © Annotations: 2003-2008 Jacquard Systems Research
Copyright © Annotations: 2008-2024 Ed de Moel.
The information in this page is
NOT authoritative and subject to be modified
at any moment.
Please consult the
appropriate (draft) language standard for an
authoritative definition.
Some specifications are "approved for inclusion in a future standard". Note that the MUMPS Development Committee cannot guarantee that such future standards will indeed be published.
This page most recently updated on 13-Sep-2014, 15:54:30.
For comments, contact Ed de Moel (demoel@jacquardsystems.com)