14 inline void replace(std::string& a_string,
char a_old,
char a_new){
16 if((*it)==a_old) *it = a_new;
20 inline bool replace(std::string& a_string,
const std::string& a_old,
const std::string& a_new){
23 if(a_old.empty())
return false;
25 std::string::size_type lold = a_old.length();
27 std::string stmp = a_string;
29 std::string::size_type pos = stmp.find(a_old);
30 if(pos==std::string::npos){
34 snew += stmp.substr(0,pos);
36 stmp = stmp.substr(pos+lold,stmp.length()-(pos+lold));
44 inline bool replace_(std::string& a_string,
const std::string& a_old,
const std::string& a_new) {
45 return replace(a_string,a_old,a_new);
48 inline bool replace(std::vector<std::string>& a_strings,
const std::string& a_old,
const std::string& a_new){
50 if(!
replace(*it,a_old,a_new))
return false;
55 inline void toxml(std::string& a_string){
64 replace(a_string,
"\"",
""");
68 inline std::string
to_xml(
const std::string& a_string){
69 std::string s = a_string;
74 inline void to_win(std::string& a_string) {
75 replace(a_string,
"/cygdrive/c",
"C:");
76 replace(a_string,
"/mnt/c",
"C:");
81 replace(a_string,
"/cygdrive/c",
"c:");
82 replace(a_string,
"/mnt/c",
"c:");