Overview
Examples
Screenshots
Comparisons
Applications
Download
Documentation
Tutorials
Bazaar
Status & Roadmap
FAQ
Authors & License
Forums
Funding Ultimate++
Search on this site
Search in forums












SourceForge.net Logo
Home » U++ Library support » U++ Core » string replacer utility functor
string replacer utility functor [message #37703] Sun, 04 November 2012 15:10
omari is currently offline  omari
Messages: 265
Registered: March 2010
Experienced Member
Hello,

to simplify multiple calls to String::Replace, i used this utility functor:

struct StringReplacer
{
	StringReplacer(String& str):string(str){}
	
	StringReplacer& operator()(String find, String replace)
	{
		string.Replace(find, replace);
		return *this;
	}
private:
	String& string;
};


usage:

	String s("Cpp");
	
	StringReplacer(s)
	("C", "U")
	("p", "+")
	;
	
	LOG(s);



Cordially

omari.


regards
omari.
Previous Topic: NTL container equivalent to STL bitset
Next Topic: Is libXi needed ??
Goto Forum:
  


Current Time: Wed Apr 24 13:07:58 CEST 2024

Total time taken to generate the page: 0.03051 seconds