小编use*_*044的帖子

如何将字符串设置为全部小写

我有一个 char foo[SIZE]; //(string)

并使用正确输入%s(如printfs正确输入),但现在要将其设置为小写。所以我尝试使用

 if (isupper(*foo)) 
   *foo=tolower(*foo); 
Run Code Online (Sandbox Code Playgroud)

即当我这样做:

printf("%s" foo); //I get the same text with upper case
Run Code Online (Sandbox Code Playgroud)

文字似乎没有改变。谢谢。

c lowercase uppercase toupper tolower

5
推荐指数
2
解决办法
2万
查看次数

标签 统计

c ×1

lowercase ×1

tolower ×1

toupper ×1

uppercase ×1