// 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);
No edit summary |
|||
(One intermediate revision by one other user not shown) | |||
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 | == Example == | ||
< | <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) | ||
</ | </syntaxhighlight> | ||
</tabber> | |||
</ | |||
== Output == | == Output == | ||
Line 32: | Line 35: | ||
<pre> | <pre> | ||
The numeric value of s is 3.1415926 | The numeric value of s is 3.1415926 | ||
The numeric value of | The numeric value of TextBox1 is 42 | ||
</pre> | </pre> | ||
Number(number)
Number converts a string to a number. It works on floats and integers.
// 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)
The numeric value of s is 3.1415926 The numeric value of TextBox1 is 42