Created
February 19, 2018 07:06
-
-
Save bwedding/fe91767b8a680196ef9f38231b4d49df to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void CPPReplace(std::string &data) | |
{ | |
const std::string s = ","; | |
const std::string t = ",\n"; | |
std::string newString = ""; | |
std::string::size_type n = 0; | |
///////////// | |
size_t loc = 0; | |
size_t start = 0; | |
while(1) | |
{ | |
if (std::string::npos != (loc = data.find(",", start))) | |
{ | |
newString += data.substr(start, (loc - start) + 1); | |
newString += "\n"; | |
start = loc + 1; // skip the comma | |
} | |
else | |
break; | |
} | |
data = newString; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment