c++代碼測試-std::string元素

//: c++代碼測試
//  std::string元素
std::string s = "mjk1MMM2122f999fg";
std::basic_string<char>::iterator it = s.begin();

locale loc;

for(; it != s.end(); it++){
 if(isdigit(*it))
  cout << *it;
 else
  if (::islower(*it))
   cout << toupper(*it, loc);
  else
   cout << tolower(*it, loc);
}
cout << endl;

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章