MC-Basic:ASC

From SoftMC-Wiki
Revision as of 16:00, 13 December 2010 by Arwiebe (talk | contribs) (Created page with '{{MC-Basic |SHORT FORM= |SYNTAX= ?ASC(''<string>{,<Index>}'') |AVAILABILITY= All versions. Available for UTF-8 string since version 4.5.10 |DESCRIPTION= ASC returns an ASCII …')
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

ASC returns an ASCII character value from within an ASCII-8 string, and the Unicoed value from within a UTF-8 string.

<return value>: corresponding ASCII character code from a specified  character in an ASCII-8 <string>, or to the Unicode value of a specified  symbol in a UTF-8 <string>.

<string>: string expression from which the character is to be picked. If the sting is empty, the function returns the value 0.

<index>: optional real value defining the position in <string> of the ASCII-8 characteror UTF-8 symbol to select. The first ASCII-8 characteror UTF-8 symbol of the string is selected if the index is omitted or has a value of 0.

Syntax

?ASC(<string>{,<Index>})

Availability

All versions. Available for UTF-8 string since version 4.5.10

Type

<return value>: Double

                             <string>: String

                             <index>: Long

Range

<return value>: 0 to 127 for an ASCII-8 <string>

0 to MAXLONG for a UTF-8 <string>

                             <string >: String

                             <index>: 0 to MaxLong

Scope

Configuration, Task or Terminal

Limitations

Read-Only

Examples

--> ?ASC("example",3)

9.700000000000000e+01              ‘returns the ASCII code for the letter "a"

--> ?ASC("example")

1.010000000000000e+02              ‘returns the ASCII code for the letter "e"

Common Shared UTF8Str as String of UTF8

UTF8Str = UTF$(196) + UTF$(197) + UTF$(198)

?ASC(UTF8str,2)

1.970000000000000e+02

See Also