Home » U++ Library support » U++ Core » no String::Replace() ?
Re: no String::Replace() ? [message #20758 is a reply to message #11279] |
Sun, 05 April 2009 09:16 |
|
forlano
Messages: 1185 Registered: March 2006 Location: Italy
|
Senior Contributor |
|
|
luzr wrote on Thu, 30 August 2007 16:23 | Seem OK, but perhaps a little bit slow. I think the fast method would be to recreate String - insertion into String can be expensive.
I would do e.g.:
String es;
for(const char *q = s; *q; q++) {
es.Cat(*q);
if(*q == '\'')
es.Cat('\'');
}
As for inclusion of some Replace to String.h, well, why not, but perhaps not as member function. It is also the question how generic it should be (what you need is sort of special case that can be handled more effectively).
Mirek
|
Hello,
is there an U++ method/function for Replace? like
Replace(String old_s, String new_s, String source)
that substitute all the occurence of old_s in source with new_s?
I was not able to find it.
Thanks,
Luigi
[Updated on: Sun, 05 April 2009 09:26] 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: Wed May 22 17:19:42 CEST 2024
Total time taken to generate the page: 0.03891 seconds
|