Asc: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
Brendon (talk | contribs)
No edit summary
 
(12 intermediate revisions by 4 users not shown)
Line 1: Line 1:
ASC(''string'')
''This function is for BASIC compatibility. It is not available in pure JavaScript projects.''  


'''Description'''
Asc(''string'')


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.
== Description ==


'''Example'''
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) ==


<pre>
<pre>
REM ASC Example
Rem Asc Example
'ASC returns an ANSI character code
'Asc returns an ANSI character code
DIM CapitalA, LowerB
 
CapitalA = ASC("A is for Apple")
Dim CapitalA, LowerB
PRINT "Character code for A = " & CapitalA
CapitalA = Asc("A is for Apple")
LowerB = ASC("b")
Print "Character code for A = " & CapitalA
PRINT "Character code for b = " & LowerB
LowerB = Asc("b")
Print "Character code for b = " & LowerB
</pre>
</pre>


'''Output'''
== Output ==


<pre>
<pre>
Line 24: Line 27:
</pre>
</pre>


'''Related Items'''
== Related Items ==
 
[[chr|Chr]]
 
[[Category:Language Reference]]
 
[[Category:Strings]]


[[chr|CHR]]
[[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

Related Items

Chr