Difference between revisions of "ParseToNumber Command"

From GeoGebra Manual
Jump to: navigation, search
m (spacing)
 
(10 intermediate revisions by 4 users not shown)
Line 1: Line 1:
<noinclude>{{Manual Page|version=4.0}}</noinclude>
+
<noinclude>{{Manual Page|version=5.0}}</noinclude>{{command|scripting}}
{{command|scripting}}
+
;ParseToNumber( <Number>, <Text> )
;ParseToNumber[ <Number a>, <String> ]
+
:Parses the text and stores the result to a [[Numbers and Angles|number]] ''a'', which must be defined and [[Free, Dependent and Auxiliary Objects|free]] before the command is used.  
:Parses the string and stores the result to [[Numbers and Angles|number]] ''a''. Number ''a'' must be defined and [[Free, Dependent and Auxiliary Objects|free]] before the command is used.
+
:{{example|1=Define <code><nowiki> a = 3</nowiki></code> and <code><nowiki> text1 = "6"</nowiki></code>. <code><nowiki> ParseToNumber(a, text1)</nowiki></code> returns ''a = 6''.}}
:{{example|1=<div> Define <code><nowiki> a = 3</nowiki></code> and <code><nowiki> text1 = "6"</nowiki></code>. </div> <code><nowiki> ParseToNumber[a, text1]</nowiki></code> returns ''a = 6''.}}
+
:{{note|1=This is a [[Scripting Commands|scripting command]] which only sets the value of a number once. To convert a text <i>text1</i> into a number which is updated dynamically, use [[FromBase Command|FromBase]](text1,10).}}
 +
 
 +
 
 +
;ParseToNumber( <Text> )
 +
:Parses the text and stores the result to a [[Numbers and Angles|number]].
 +
:{{example|1=<code><nowiki>ParseToNumber("1+2+5-pi")</nowiki></code> creates the number ''a = 4.86''.}}
 +
 
 +
 
 +
:{{note|1=See also [[ParseToFunction Command|ParseToFunction ]] command. }}

Latest revision as of 18:43, 13 April 2022


ParseToNumber( <Number>, <Text> )
Parses the text and stores the result to a number a, which must be defined and free before the command is used.
Example: Define a = 3 and text1 = "6". ParseToNumber(a, text1) returns a = 6.
Note: This is a scripting command which only sets the value of a number once. To convert a text text1 into a number which is updated dynamically, use FromBase(text1,10).


ParseToNumber( <Text> )
Parses the text and stores the result to a number.
Example: ParseToNumber("1+2+5-pi") creates the number a = 4.86.


Note: See also ParseToFunction command.
© 2024 International GeoGebra Institute