这个 托洛尔() 是C/C++中的一个内置函数,用于将给定的宽字符转换为小写。它是在 cwctype C++的头文件。
null
- 它是头文件中的一个函数
,因此,如果使用此函数,则必须使用此头文件 - 它是tolower()函数的宽字符等价物。
语法 :
wint_t towlower( wint_t ch )
参数 :该函数接受一个强制参数 中国 它指定了必须转换为小写的宽字符。
返回值 :如果存在此类值,则函数返回与c等价的小写字母,否则返回c(未更改)。该值作为wint_t值返回,该值可以隐式转换为wchar_t。
下面的程序说明了上述功能。
方案1 :
// Program to illustrate // towlower() function #include <cwchar> #include <cwctype> #include <iostream> using namespace std; int main() { wchar_t str[] = L "GeeksforGeeks" ; wcout << L "The lowercase version of "" << str << L "" is " ; for ( int i = 0; i < wcslen(str); i++) // Function to convert the character // into the lowercase version, if exists putwchar(towlower(str[i])); return 0; } |
输出:
The lowercase version of "GeeksforGeeks" is geeksforgeeks
方案2 :
// Program to illustrate // towlower() function #include <cwchar> #include <cwctype> #include <iostream> using namespace std; int main() { wchar_t str[] = L "hello Ishwar 123!@#" ; wcout << L "The lowercase version of "" << str << L "" is " ; for ( int i = 0; i < wcslen(str); i++) // Function to convert the character // into the lowercase version, if exists putwchar(towlower(str[i])); return 0; } |
输出:
The lowercase version of "hello Ishwar 123!@#" is hello ishwar 123!@#
© 版权声明
文章版权归作者所有,未经允许请勿转载。
THE END