AnsiStrings.AnsiReplaceStr
From RAD Studio VCL Reference
Contents |
Delphi Information
From AnsiStrings.pas
function AnsiReplaceStr(const AText: AnsiString; const AFromText: AnsiString; const AToText: AnsiString): AnsiString; overload;
Unit: AnsiStrings
Type: function
Visibility: public
C++ Information
From AnsiStrings.hpp
System::AnsiStringT<0> __fastcall AnsiReplaceStr(System::AnsiStringT<0> AText, System::AnsiStringT<0> AFromText, System::AnsiStringT<0> AToText);
Unit: AnsiStrings
Type: function
Description
Replaces all occurrences of a substring within a string, using case-sensitive search.
Use AnsiReplaceStr to replace all occurrences of the substring AFromText with the string AToText, within the string AText. AnsiReplaceStr returns the string obtained after replacement.
Use AnsiReplaceText to do a case-insensitive replacement.
Note: Both the parameters and the return value are of type AnsiString. To do the replacement in a UnicodeString context, use the ReplaceStr function. Also, to do the replacement in a WideString context, use the WideReplaceStr function.
Note: Recursive replacement of substrings is not supported. This means that if the substitution of AToText results in a new match for AFromText, that match is not replaced.
AnsiReplaceStr is the same function as ReplaceStr.
The StringReplace function is a more general replacement routine, giving case-sensitivity options, as well as the option to decide whether to replace all occurrences or the first occurrence of the substring in the string.