Home » U++ Library support » U++ Core » no String::Replace() ?
Re: no String::Replace() ? [message #21511 is a reply to message #20819] |
Sat, 23 May 2009 19:13 |
|
koldo wrote on Fri, 10 April 2009 18:27 | Hello all
If anybody needs them, in bazaar/sysinfo there are these functions:
...............
// Replace find with replace in str
String Replace(String str, String find, String replace)
Best regards
Koldo
|
OK... I created replace method too:
String replace_string(String& s1, String& find, String replace){
String string_result;
int start_pos = 0;
int found_pos = 0;
int find_len = find.GetCount();
int s1_count = s1.GetCount();
while(((found_pos=s1.Find(find, start_pos))!=-1)){
string_result.Cat(s1.Mid(start_pos, found_pos - start_pos));
string_result.Cat(replace);
start_pos = found_pos + find_len;
};
if(start_pos<s1.GetCount())
string_result.Cat(s1.Mid(start_pos));
return (string_result);
}
If is possible, may be add the most optimized replace function in String utilities!
It is very usefull method!
[Updated on: Sat, 23 May 2009 19:15] Report message to a moderator
|
|
|
|
|
no String::Replace() ?
By: guido on Wed, 29 August 2007 19:44
|
|
|
Re: no String::Replace() ?
By: mirek on Thu, 30 August 2007 16:23
|
|
|
Re: no String::Replace() ?
By: forlano on Sun, 05 April 2009 09:16
|
|
|
Re: no String::Replace() ?
By: mirek on Sun, 05 April 2009 09:45
|
|
|
Re: no String::Replace() ?
By: koldo on Fri, 10 April 2009 17:27
|
|
|
Re: no String::Replace() ?
By: forlano on Fri, 10 April 2009 20:12
|
|
|
Re: no String::Replace() ?
By: tojocky on Sat, 23 May 2009 19:13
|
|
|
Re: no String::Replace() ?
By: alendar on Mon, 08 March 2010 02:18
|
|
|
Re: no String::Replace() ?
By: sevenjay on Thu, 07 October 2010 15:13
|
|
|
Re: no String::Replace() ?
By: mirek on Sun, 10 October 2010 20:01
|
|
|
Re: no String::Replace() ?
By: mdelfede on Mon, 11 October 2010 09:39
|
|
|
Re: no String::Replace() ?
By: zsolt on Sat, 16 October 2010 02:02
|
|
|
Re: no String::Replace() ?
|
|
|
Re: no String::Replace() ?
By: mirek on Mon, 11 October 2010 12:19
|
|
|
Re: no String::Replace() ?
By: zsolt on Sat, 16 October 2010 02:14
|
Goto Forum:
Current Time: Fri May 03 19:28:36 CEST 2024
Total time taken to generate the page: 0.02626 seconds
|