Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Scroll tablelayout
sortDirectionASC
repeatTableHeadersdefaultstyle
widths18%, 11%, 13%, 58%
style
sortByColumn1
sortEnabledfalse
cellHighlightingtrue

...

Returns a new string with the old values replaced with new.

Scroll pagebreak

Examples

Code Block
languagetext
// Demonstrate usage of strReplace

...


string $str = "This is some text";

...


string $newStr;

...


 

...

// Replace "some" with "a bit of"

...


$newStr = `strReplace $str "some" "a bit of"`;

...


print $newStr; 

...

// Should be "This is a bit of text"

...


 

...

// Remove all occurrences of "i" in the new string

...


$newStr = `strReplace $newStr "i" ""`;

...


print $newStr; 

...

// Should be "Ths s a bt of text"

...


 

...

// Replace all x's with s's

...


$newStr = `strReplace $str "x" "s"`;

...


print $newStr; 

...


// Should be "This is some test"

Additional information

Related commands

...