Number: Difference between revisions

From NSB App Studio
Jump to navigation Jump to search
C185driver (talk | contribs)
No edit summary
 
Line 5: Line 5:
Number converts a string to a number. It works on floats and integers.
Number converts a string to a number. It works on floats and integers.


== Example (BASIC) ==
== Example ==


<pre>
<tabber>
JavaScript=
<syntaxhighlight lang="JavaScript">
// Number Example
// Number returns the numeric value of a string
 
var s;
s = "3.145926";
NSB.Print "The numeric value of s is " & Number(s);
NSB.Print "The numeric value of TextBox1 is " & Number(TextBox1.value);
</syntaxhighlight>
|-|
BASIC=
<syntaxhighlight lang="vb.net">
Rem Number Example
Rem Number Example
'Number returns the numeric value of a string
'Number returns the numeric value of a string
Line 15: Line 28:
Print "The numeric value of s is " & Number(s)
Print "The numeric value of s is " & Number(s)
Print "The numeric value of TextBox1 is " & Number(TextBox1.value)
Print "The numeric value of TextBox1 is " & Number(TextBox1.value)
</pre>
</syntaxhighlight>
 
</tabber>
== Example (JavaScript) ==
<pre>
// Number Example
// Number returns the numeric value of a string
 
var s;
s = "3.145926";
NSB.Print "The numeric value of s is " & Number(s);
NSB.Print "The numeric value of TextBox1 is " & Number(TextBox1.value);
</pre>


== Output ==
== Output ==

Latest revision as of 22:50, 24 July 2019

Number(number)

Description

Number converts a string to a number. It works on floats and integers.

Example

// Number Example
// Number returns the numeric value of a string

var s;
s = "3.145926";
NSB.Print "The numeric value of s is " & Number(s);
NSB.Print "The numeric value of TextBox1 is " & Number(TextBox1.value);

Rem Number Example
'Number returns the numeric value of a string

Dim s
s = "3.145926"
Print "The numeric value of s is " & Number(s)
Print "The numeric value of TextBox1 is " & Number(TextBox1.value)

Output

The numeric value of s is 3.1415926
The numeric value of TextBox1 is 42

Related Items

conversions