ctype::tolower

转换字符或字符范围为小写。

CharType tolower(
    CharType ch
) const;
const CharType *tolower(
    CharType* first, 
    const CharType* last,
) const;

参数

  • ch
    将转换为小写的字符。

  • first
    到第一个字符的指针。情况要转换的字符范围。

  • last
    为字符的指针。在情况要转换的字符范围内的最后一个字符之后。

返回值

成员函数返回第一个参数的 ch的小写形式。 如果小写形式不存在,则返回 ch。

第二个成员函数返回 last。

备注

第一个成员函数返回 do_tolower(ch)。 第二个成员函数返回 do_tolower(first,last)。

示例

// ctype_tolower.cpp
// compile with: /EHsc
#include <locale>
#include <iostream>
using namespace std;

int main( )
{
   locale loc1 ( "German_Germany" );
   
   char string[] = "HELLO, MY NAME IS JOHN";

   use_facet<ctype<char> > ( loc1 ).tolower
      ( string, string + strlen(string) );
   cout << "The lowercase string is: " << string << endl;
}
  

要求

页眉: <区域设置>

命名空间: std

请参见

参考

ctype 类