Advertisement
patrykoleszkiewicz

'Convert string to camel case' Kata Solution

Dec 12th, 2019
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.29 KB | None | 0 0
  1. #include <string>
  2.  
  3. std::string to_camel_case(std::string text) {
  4.     std::string output;
  5.     for(int iter = 0; iter < text.size(); ++iter)
  6.     {
  7.         if(text.at(iter) == '-' || text.at(iter) == '_')
  8.         {
  9.             text.at(iter) = toupper(text.at(++iter));
  10.         }
  11.         output += text.at(iter);
  12.     }
  13.     return output;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement