1. string형에서 바꾸고자 할 때

#include <algorithm>
#include <cctype>
// 위의 2개의 라이브러리 추가

string s;

> lowercase all characters
transform (s.begin(), s.end(),  s.begin(), tolower);                 
   
> uppercase all characters
transform (s.begin(), s.end(), s.begin(), toupper);    

[출처] http://blog.naver.com/PostView.nhn?blogId=young4862&logNo=100088120933&redirect=Dlog&widgetTypeCall=true



2. char형에서 바꾸고자 할 때

#include <string>
// string 라이브러리가 있어야 사용 가능

char c[20];

> lowercase all characters
strlwr(c);

> uppercase all characters
strupr(c);

[출처] http://blog.naver.com/PostView.nhnblogId=young4862&logNo=100088120933&redirect=Dlog&widgetTypeCall=true


'프로그래밍 > C/C++' 카테고리의 다른 글

반올림 함수  (0) 2012.03.28
Single char to int  (0) 2012.03.15
getline(cin, temp);  (0) 2011.09.26
Visual Studio 2010에서 콘솔 창이 바로 꺼질 때  (0) 2011.06.22
C++ string tokenizer  (0) 2011.05.27
Posted by halloRa
,