#include <stdlib.h> #include <string.h> #include <ctype.h> /* 功能:將輸入的字符串中英文大寫字母改成對應小寫字母,並且過濾掉非英文字母字符 輸入:字符串 輸出:結果字符串,保證輸出地址有效。 返回:0表示成功,其它返回-1 */ int ProcessString(char * strInput,char *strOutput) { while (*strInput) { if (isalpha(*strInput)) { char single = *strInput; *strOutput = tolower(single); strOutput++; } strInput++; } return 0; }