Asc: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
JwellsNB (talk | contribs)
m Add JavaScript version of VBScript
Line 5: Line 5:
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>
Line 15: Line 15:
LowerB = Asc("b")
LowerB = Asc("b")
Print "Character code for b = " & LowerB
Print "Character code for b = " & LowerB
</pre>
== Example (JavaScript) ==
<pre>
//Asc Example
//Asc returns an ANSI character code
var CapitalA, LowerB;
CapitalA = Asc("A is for Apple");
NSB.Print("Character code for A = " + CapitalA + "<br>");
LowerB = Asc("b");
NSB.Print("Character code for b = " + LowerB + "<br>");
</pre>
</pre>



Revision as of 18:48, 21 April 2013

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

Example (JavaScript)

//Asc Example
//Asc returns an ANSI character code
var CapitalA, LowerB;
CapitalA = Asc("A is for Apple");
NSB.Print("Character code for A = " + CapitalA + "<br>");
LowerB = Asc("b");
NSB.Print("Character code for b = " + LowerB + "<br>");

Output

Character code for A = 65
Character code for b = 98

Related Items

Chr