Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string underscoredeleter(string name)
- {
- string s, s1, temps;
- static int start = 0, finder, temp;
- finder = name.find('_', start);
- temp = finder;
- s = name.substr(start, finder);
- s1 = name.substr(finder+1, name.length()-finder);
- if(s == name)
- {
- return name;
- }
- if ((s1.find('_', start)== -1) && (s1.compare(s)!=0 && (s1.length() != s.length())))
- return s + " " + s1;
- else
- {
- while (1)
- {
- if ((finder = s1.find('_', start)) != -1)
- {
- finder = s1.find('_', start);
- temps = s1.substr(start, finder);
- s1.erase(start, finder+1);
- if (s1.find('_', start) != -1)
- {
- s = s + " " + temps;
- }
- else
- {
- s = s + " " + temps + " " + s1;
- }
- }
- else if(s1.length() == s.length())
- return s + " " + s1;
- else
- return s;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement