示例#1
0
 types::str capitalize(types::str const &s)
 {
   if (s.empty())
     return s;
   else {
     types::str copy = s;
     copy[0] = ::toupper(s[0]);
     std::transform(s.begin() + 1, s.end(), copy.begin() + 1, ::tolower);
     return copy;
   }
 }
示例#2
0
 bool isalpha(types::str const &s)
 {
   return !s.empty() && std::all_of(s.chars().begin(), s.chars().end(),
                                    (int (*)(int))std::isalpha);
 }