字符串小写变大写

ivefire 2003-12-29 10:47:31
windows下有strupr函数,linux7.2下有什么相似的函数,在哪个头文件声明的?
...全文
220 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
autoegg 2003-12-30
  • 打赏
  • 举报
回复
根据ASCII码自己写一个也不麻烦。:)
linaxing 2003-12-30
  • 打赏
  • 举报
回复
用toupper()自己写一个。
applezhang 2003-12-30
  • 打赏
  • 举报
回复
void strupr(char *pcSrc)
{
int i;
whille(*pcSrc!='\0')
{
for (i=0; i<strlen(pcSrc);i++)
{
if (pcSrc[i] >= 'a' && pcSrc[i] <= 'z') pcSrc[i] -= 32;
}
}
}
HostOOP 2003-12-30
  • 打赏
  • 举报
回复
为什么自己不写呢?

char *strupr(char *str)
{
char *tmp = str;

while (*str != '\0')
{
if (*str >='a' && *str<='z')
*str -= 32;
}
return tmp;
}
yuanlei1978113 2003-12-30
  • 打赏
  • 举报
回复
#include <ctype.h>

int toupper(int c);
int tolower(int c);

DESCRIPTION
toupper() converts the letter c to upper case, if possible.

tolower() converts the letter c to lower case, if possible.

If c is not an unsigned char value, or EOF, the behaviour of these
functions is undefined.

RETURN VALUE
The value returned is that of the converted letter, or c if the conver-
sion was not possible.

23,120

社区成员

发帖
与我相关
我的任务
社区描述
Linux/Unix社区 应用程序开发区
社区管理员
  • 应用程序开发区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧