replace()
Replace a specified string in text with a specified replacement string.
Syntax
replace(text,str,replacement_str)
Parameter
Parameter | Definition |
---|---|
text | original text |
str | text string to be found in text |
replacement_str | text string to replace str that is found in text |
Description
Use the replace() function instead of PSL common string manipulation techniques. All occurrences of str in text are replaced with replacement_str, and the result is returned.
Example
The following example demonstrates the replace() function:
#This example replaces the string "Hello there" with Hello world
new_text = replace("Hello there","there","world");
printf("%s",new_text);
new_text = replace("Hello there","there","world");
printf("%s",new_text);
The example above produces the following output:
Hello world
Tip: For faster searching, add an asterisk to the end of your partial query. Example: cert*