islower
函数 <cctype>
int islower ( int c )
检查字符是否为小写字母
检检查c是否为小写字母。
请注意,是不是一个字母可能取决于所使用的地区;在默认的“C”语言环境中,
小写字母是下列任何一个:a b C de g h j k l m n o p q r s t u v w x y z。
在c++中,该函数的特定区域的模板版本(islower)存在于头文件<locale>中。
☲ 参数
c
将要被检查、转换为int或EOF的字符。
☉ 返回值
如果c确实是一个小写字母,返回一个不等于零的值(如,true)。否则返回零(即false)。
☣ 示例
/* islower example */
#include <stdio.h>
#include <ctype.h>
int main ()
{
int i=0;
char str[]="Test String.\n";
char c;
while (str[i])
{
c=str[i];
if (islower(c)) c=toupper(c);
putchar (c);
i++;
}
return 0;
} |
输出:
TEST STRING.
🍄 另请参阅