字符串大小写转换

xiaoxiao2021-02-28  68

头文件

#include <string.h> // for strlen #include <ctype.h> // for toupper

字符串转大写

void WhStrUpper(char *pszString) { if (pszString == NULL) { return; } size_t i = 0; for (i = 0; i < strlen(pszString); i++) { pszString[i] = toupper(pszString[i]); } }

字符串转小写

void WhStrLower(char *pszString) { if (pszString == NULL) { return; } size_t i = 0; for (i = 0; i < strlen(pszString); i++) { pszString[i] = tolower(pszString[i]); } }
转载请注明原文地址: https://www.6miu.com/read-43145.html

最新回复(0)