Asc: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
|||
(8 intermediate revisions by 4 users not shown) | |||
Line 1: | Line 1: | ||
''This function is for BASIC compatibility. It is not available in pure JavaScript projects.'' | |||
Asc(''string'') | Asc(''string'') | ||
Line 5: | Line 7: | ||
Asc returns the ANSI character code of a character. The required parameter, ''string'', is any valid string expression. If ''string'' is longer than one character, only the first character is used. | Asc returns the ANSI character code of a character. The required parameter, ''string'', is any valid string expression. If ''string'' is longer than one character, only the first character is used. | ||
== Example == | == Example (BASIC) == | ||
<pre> | <pre> | ||
Rem Asc Example | Rem Asc Example | ||
'Asc returns an ANSI character code | 'Asc returns an ANSI character code | ||
Dim CapitalA, LowerB | Dim CapitalA, LowerB | ||
CapitalA = Asc("A is for Apple") | CapitalA = Asc("A is for Apple") | ||
Line 29: | Line 32: | ||
[[Category:Language Reference]] | [[Category:Language Reference]] | ||
[[Category:Strings]] | |||
[[Category:BASIC Functions]] |
Latest revision as of 15:17, 25 March 2019
This function is for BASIC compatibility. It is not available in pure JavaScript projects.
Asc(string)
Description
Asc returns the ANSI character code of a character. The required parameter, string, is any valid string expression. If string is longer than one character, only the first character is used.
Example (BASIC)
Rem Asc Example 'Asc returns an ANSI character code Dim CapitalA, LowerB CapitalA = Asc("A is for Apple") Print "Character code for A = " & CapitalA LowerB = Asc("b") Print "Character code for b = " & LowerB
Output
Character code for A = 65 Character code for b = 98