Difference between revisions of "ReplaceAll Command"

From GeoGebra Manual
Jump to: navigation, search
(added note and example)
 
Line 1: Line 1:
 
<noinclude>{{Manual Page|version=5.0}}</noinclude> {{command|text}}
 
<noinclude>{{Manual Page|version=5.0}}</noinclude> {{command|text}}
 
;ReplaceAll( <Text>, <Text to Match>, <Text to Replace> )
 
;ReplaceAll( <Text>, <Text to Match>, <Text to Replace> )
:Replaces the given ''text to match'' in a text string with the given ''text to replace''.
+
:Creates a new text containing the given ''text'' whose ''text to match'' has been replaced with the given ''text to replace''.
:{{Example|1=<code>ReplaceAll("3cos(t)+cos(2y)", "cos", "sin")</code> gives <code>"3sin(t)+sin(2y)"</code>.}}
+
:{{Example|1=<code>ReplaceAll("3cos(t)+cos(2y)", "cos", "sin")</code> creates the new text <code>"3sin(t)+sin(2y)"</code>.}}
 +
 
 +
{{Note|1=Use the [[FormulaText Command|FormulaText]] command to create a LaTeX text.}}
 +
{{Example|1=<code>FormulaText(ReplaceAll("3cos(t)+cos(2y)", "cos", "sin"))</code> creates the new LaTeX text <code>"3sin(t)+sin(2y)"</code>.}}

Latest revision as of 11:12, 15 April 2022


ReplaceAll( <Text>, <Text to Match>, <Text to Replace> )
Creates a new text containing the given text whose text to match has been replaced with the given text to replace.
Example: ReplaceAll("3cos(t)+cos(2y)", "cos", "sin") creates the new text "3sin(t)+sin(2y)".


Note: Use the FormulaText command to create a LaTeX text.
Example: FormulaText(ReplaceAll("3cos(t)+cos(2y)", "cos", "sin")) creates the new LaTeX text "3sin(t)+sin(2y)".
© 2022 International GeoGebra Institute