C/C++庫函數(tolower/toupper)實現字母的大小寫轉換

本文將介紹庫函數實現字母的大小寫轉換,經常使用到的是在ctype.h(C++中是cctype)庫文件下定義的函數方法。首先來看一下C下tolower/toupper函數實現原型:函數 int tolower(int c) { if ((c >= 'A') && (c <= 'Z')) return c + ('a' - 'A'); return c; } int toupper(int
相關文章
相關標籤/搜索