Difference between revisions of "MC-Basic:ASC"
(9 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
+ | {{Languages|MC-Basic:ASC}} | ||
{{MC-Basic | {{MC-Basic | ||
|SHORT FORM= | |SHORT FORM= | ||
Line 4: | Line 5: | ||
|SYNTAX= | |SYNTAX= | ||
− | ?ASC('' | + | ?ASC(<''string''>{,<''Index''>}) |
|AVAILABILITY= | |AVAILABILITY= | ||
Line 10: | Line 11: | ||
|DESCRIPTION= | |DESCRIPTION= | ||
− | ASC returns an ASCII character value from within an ASCII-8 ''string, ''and the | + | ASC returns an ASCII character value from within an ASCII-8 ''string, ''and the Unicode 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. | <''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 | + | <''index''>: optional real value defining the position in ''<string>'' of the ASCII-8 character or UTF-8 symbol to select. The first ASCII-8 character or UTF-8 symbol of the string is selected if the index is omitted or has a value of 0. |
|TYPE= | |TYPE= | ||
− | '' | + | <''return value''>: Double |
− | '' | + | <''string''>: String |
− | '' | + | <''index''>: Long |
|RANGE= | |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 | |
− | |||
− | '' | ||
|UNITS= | |UNITS= | ||
Line 44: | Line 43: | ||
|LIMITATIONS= | |LIMITATIONS= | ||
− | Read | + | Read only |
|EXAMPLE= | |EXAMPLE= | ||
Line 66: | Line 65: | ||
|SEE ALSO= | |SEE ALSO= | ||
− | * [[ | + | * [[MC-Basic:INSTR|INSTR]] |
− | + | * [[MC-Basic:SPACE$|SPACE$]] | |
− | [[:Category | + | * [[MC-Basic:STRING$|STRING$]] |
+ | * [[MC-Basic:UTF$|UTF$]] | ||
+ | * [[MC-Basic:CHR$|CHR$]] | ||
+ | [[Category:MC-Basic:String_Manipulation|ASC]] | ||
}} | }} |
Latest revision as of 03:19, 17 April 2017
Language: | English • 中文(简体) |
---|
ASC returns an ASCII character value from within an ASCII-8 string, and the Unicode 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 character or UTF-8 symbol to select. The first ASCII-8 character or 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