STD.Str.FindReplace( source, target, replacement )
STD.Uni.FindReplace( source, target, replacement )
STD.Uni.LocaleFindReplace( source, target, replacement, locale )
source | A string containing the data to search. |
target | A string containing the substring to search for. |
replacement | A string containing the replacement data. |
locale | A null-terminated string containing the language and country code to use to determine correct sort order and other operations. |
Return: | FindReplace returns a STRING or UNICODE value, as appropriate. |
The FindReplace functions return the source string with the replacement string substituted for all instances of the target string . If the target string is not in the source string, it returns the source string unaltered.
Example:
A := STD.Str.FindReplace('ABCDEABCDE', 'BC','XY'); //A contains 'AXYDEAXYDE' A := STD.Uni.FindReplace(u'abcde', u'a', u'AAAAA'); //A contains u'AAAAAbcde' A := STD.Uni.FindReplace(u'aaaaa', u'aa', u'b'); //A contains u'bba' A := STD.Uni.FindReplace(u'aaaaaa', u'aa', u'b'); //A contains u'bbb' A := STD.Uni.LocaleFindReplace(u'gh\u0131klm', u'hyk', u'XxXxX', 'lt'); //A contains u'gXxXxXlm' A := STD.Uni.LocaleFindReplace(u'gh\u0131klm', u'hyk', u'X', 'lt'); //A contains u'gXlm'