2011-03-22 wcdj
问题描述:
i wanna to make a prog which convert small case letters entered by user to upper case letters....i TRIED to use toupper function ...but it only do action with a single character...is there any function which convert all characters like "lovely hakeem" to "LOVELY HAKEEM"
(NOT BY LOOP)
There is no way to convert all characters to upper or lower case without looping through the string.
下面总结几种常用的大写转小写的方法
方法1:逐个字符判断,是大写字母+32
方法2:使用标准库算法transform
方法3:使用ctype中的函数
方法4:使用string中的函数 (NOT ANSI standard)
PS: A foreigner's method
更多内容参考:
http://www.cplusplus.com/forum/general/33439/
http://www.cplusplus.com/forum/beginner/14081/
http://topic.csdn.net/u/20071015/21/4c266542-c3a6-4a5a-9754-fc7574ca5ef6.html