Content


NTL
Core
ReplaceAll

ReplaceAll



Replace all occurrences of substring in specified string with specified value.

You can find more information in comments below.

/**
Replace all occurrences of substring "search" in string "str" on substring "replace" and return new string 
@param str String where to search 
@param search Searching string 
@param replace String to replace with 
@return String where all occurrences of "search" is replaced with "replace" 
*/
String ReplaceAll(const String &str, const String &search, const String &replace);
/**
Replace all occurrences of substring "search" in ANSI string "str" on substring "replace" and return new ANSI string 
@param str String where to search 
@param search Searching string 
@param replace String to replace with 
@return String where all occurrences of "search" is replaced with "replace" 
*/
AnsiString ReplaceAll(const AnsiString &str, const AnsiString &search, const AnsiString &replace);
/**
Replace all occurrences of substrings "search" in string "str" on substrings "replace" and return new string 
@param str String where to search 
@param search Searching strings 
@param replace Strings to replace with. The size should be equal to the size of "search" 
@return String where all occurrences of "search" is replaced with "replace" 
*/
String ReplaceAll(const String &str, const StringArray &search, const StringArray &replace);
/**
Replace all occurrences of substrings "search" in ANSI string "str" on substrings "replace" and return new ANSI string 
@param str String where to search 
@param search Searching strings 
@param replace Strings to replace with. The size should be equal to the size of "search" 
@return String where all occurrences of "search" is replaced with "replace" 
*/
AnsiString ReplaceAll(const AnsiString &str, const AnsiStringArray &search, const AnsiStringArray &replace);
/**
Replace all occurrences of substring "pair.first" in string "str" on substring "pair.second" and return new string 
@param str String where to search 
@param pair Search and replace parts 
@return String where all occurrences of "pair.first" is replaced with "pair.second" 
*/
String ReplaceAll(const String &str, const StringKeyValue &pair);
/**
Replace all occurrences of substrings "pairs[].first" in string "str" on substrings "pairs[].second" and return new string 
@param str String where to search 
@param pairs Search and replace pairs 
@return String where all occurrences of "pairs[].first" is replaced with "pairs[].second" 
*/
String ReplaceAll(const String &str, const StringKeyValueArray &pairs);
/**
Replace all occurrences of substring "pair.first" in ANSI string "str" on substring "pair.second" and return new ANSI string 
@param str String where to search 
@param pair Search and replace pair 
@return String where all occurrences of "pair.first" is replaced with "pair.second" 
*/
AnsiString ReplaceAll(const AnsiString &str, const AnsiStringKeyValue &pair);
/**
Replace all occurrences of substrings "pairs[].first" in ANSI string "str" on substrings "pairs[].second" and return new ANSI string 
@param str String where to search 
@param pairs Search and replace pairs 
@return String where all occurrences of "pairs[].first" is replaced with "pairs[].second" 
*/
AnsiString ReplaceAll(const AnsiString &str, const AnsiStringKeyValueArray &pairs);
Namespace: nitisa
Include: Nitisa/Core/Strings.h