Difference between revisions of "TextReplace"

Line 2: Line 2:
 
[[Category:Doc Status D]] <!-- For Lumina use, do not change -->
 
[[Category:Doc Status D]] <!-- For Lumina use, do not change -->
 
   
 
   
= TextReplace( text, pattern, subst'', all, caseInsensitive'' ) =
+
== TextReplace(text, pattern, subst'', all, caseInsensitive'') ==
  
Replaces the occurrence of ''pattern'' in ''text'' by ''subst''.
+
Replaces the occurrence of «pattern» in «text» by «subst».
  
If ''all'' is omitted or False, replaces only the first occurrence.  If ''all' is True, replaces every occurrence of ''pattern''.
+
If «all» is omitted or <code>False</code>, replaces only the first occurrence.  If «all» is <code>True</code>, replaces every occurrence of «pattern».
  
If ''caseInsensitive'' is True, matches to ''pattern'' in a case-insensitive fashion.
+
If «caseInsensitive» is <code>True</code>, matches to «pattern» in a case-insensitive fashion.
 
 
= Library =
 
  
 +
== Library ==
 
Text Functions  
 
Text Functions  
  
= Examples =
+
== Examples ==
 +
:<code>TextReplace("One for one and one for all", "one", "two") &rarr; </code>
 +
:<code>"One for two and one for all"</code>
  
{| border="0"
+
:<code>TextReplace("One for one and one for all", "one", "two", caseInsensitive: True) &rarr;</code>
|[[TextReplace]]("One for one and one for all", "one", "two")
+
:<code>"two for one and one for all"</code>
|&rarr;||"One for two and one for all"
+
|-
+
:<code>TextReplace("One for one and one for all", "one", "two", all: True) &rarr;</code>
|[[TextReplace]]("One for one and one for all", "one", "two", caseInsensitive:True)  
+
:<code>"One for two and two for all"</code>
|&rarr;||"two for one and one for all"  
 
|-
 
|[[TextReplace]]("One for one and one for all", "one", "two", all:True)  
 
|&rarr;||"One for two and two for all"
 
|-
 
|[[TextReplace]]("One for one and one for all", "one", "two", all:True, caseInsensitive:True)
 
|&rarr;||"two for two and two for all"
 
|}
 
  
= See Also =
+
:<code>TextReplace("One for one and one for all", "one", "two", all: True, caseInsensitive: True) &rarr;</code>
 +
:<code>"two for two and two for all"</code>
  
* [[SelectText]], [[FindInText]]
+
== See Also ==
 +
* [[SelectText]]
 +
* [[FindInText]]
 
* [[Text Concatenation Operator: &]]
 
* [[Text Concatenation Operator: &]]
 
* [[Chr]]
 
* [[Chr]]
* [[TextTrim]], [[SplitText]], [[JoinText]]
+
* [[TextTrim]]
* [[TextUpperCase]], [[TextLowerCase]]
+
* [[SplitText]]
 +
* [[JoinText]]
 +
* [[TextUpperCase]]
 +
* [[TextLowerCase]]
 
* [[Regular Expressions]]
 
* [[Regular Expressions]]

Revision as of 04:13, 14 January 2016


TextReplace(text, pattern, subst, all, caseInsensitive)

Replaces the occurrence of «pattern» in «text» by «subst».

If «all» is omitted or False, replaces only the first occurrence. If «all» is True, replaces every occurrence of «pattern».

If «caseInsensitive» is True, matches to «pattern» in a case-insensitive fashion.

Library

Text Functions

Examples

TextReplace("One for one and one for all", "one", "two") →
"One for two and one for all"
TextReplace("One for one and one for all", "one", "two", caseInsensitive: True) →
"two for one and one for all"
TextReplace("One for one and one for all", "one", "two", all: True) →
"One for two and two for all"
TextReplace("One for one and one for all", "one", "two", all: True, caseInsensitive: True) →
"two for two and two for all"

See Also

Comments


You are not allowed to post comments.