c++ - Removing capitals and lengthening contractions in a string -
i'm trying replace capitals lengthening contractions used in string. i'm trying find fastest , efficient approach.
here attempt, not working:
note: ur
'unrefined input'
//removing capitals std::transform(ur.begin(), ur.end(), ur.begin(), ::tolower); //removing contractions std::replace( ur.begin(), ur.end(), "it's", "it is");
here what's included in program
#include <iostream> #include <string> #include <algorithm>
your post contains 2 different questions, both of duplicates, , not saying what "is not working".
removing capitals
the way writing correct if using ascii characters only. see this answer more details supporting locales , other encodings.
replacing contractions
this hard if want efficient. if want replace each contraction 1 one, shouldn't use replace
(it replace characters, not substrings). have @ this answer.
Comments
Post a Comment