字符串大小写格式化

void toLower(std::string& s)
{
 char * buf;
 const char * end = s.c_str() + s.length();
 for (buf = (char*) s.c_str(); buf != end; buf++)
 {
  *buf = ::toupper(*buf);
 }
}

void strtoupper(string &s)
{
 uint nLength = strlen(s.c_str());
 for (uint i = 0; i < nLength; i++)
  s[i] =  char(toupper(s[i]));
}

posted @ 2012-05-09 11:28  byfei  阅读(115)  评论(0)    收藏  举报