Linux C function() 參考手冊:字符串轉換篇-toupper(將小寫字母轉換成大寫字母)

Linux C function() 參考手冊:字符串轉換篇-toupper(將小寫字母轉換成大寫字母)

Linux C function() 參考手冊:字符串轉換篇-toupper(將小寫字母轉換成大寫字母)

 

資料來源:http://people.cs.nctu.edu.tw/~yslin/library/linuxc/main.htm
線上執行:http://www.tutorialspoint.com/compile_c_online.php
code2html:http://tohtml.com/

 

相關函數
isalpha,tolower
表頭文件
#include<ctype.h>
定義函數
int toupper(int c);
函數說明
若參數c為小寫字母則將該對映的大寫字母返回。
返回值
返回轉換後的大寫字母,若不須轉換則將參數c值返回。
附加說明

範例

 

#include <stdio.h>
#include <ctype.h>
main()
{
char s[]="aBcDeFgH12345;!#$";
int i;
printf("before toupper() : %s\n",s);
for(i=0;I<sizeof(s);i++)
{
s[i]=toupper(s[i]);
}
printf("after toupper() : %s\n",s);
}

 

 


發表迴響

你的電子郵件位址並不會被公開。 必要欄位標記為 *