반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- bit
- Context
- css
- array
- JSX
- nodeJS
- server
- Props
- route
- axios
- queue
- priority_queue
- c++
- component
- Navigation
- UE5
- React
- event
- leetcode
- MySQL
- BinaryTree
- node.js
- treenode
- map
- DP
- count
- routes
- 비트연산
- Callback
- state
Archives
- Today
- Total
우사미 코딩
[C++] ASCII를 사용하여 uppercase <-> lowercase 변환하기 본문
반응형
- the ASCII values of all 26 uppercase alphabet characters are 65–90
A : 65, B : 66 ....... Z : 90
- the ASCII values of all 26 lowercase alphabet characters are 97–122
a : 97, b: 98 .... z: 122
string s = "Test"이고 대문자를 소문자로 변환해야 할 때
if(s[i] >= 65 && s[i] <= 90)
s[i] = s[i] + 32;
위와 같이 변환하면 됨
또는
if (s[i] >= 'A' && s[i] <= 'Z')
s[i] += 32;
끝
반응형
'Programming (C++) > C++' 카테고리의 다른 글
[C++] 알파벳 a-z ↔ 0-26 변환하는 방법 (int ↔ char) (0) | 2023.05.21 |
---|---|
[C++ / istringstream] string 문자열을 공백문자를 기준으로 나누기 (0) | 2023.04.28 |
[C++] 10진수를 2진수로 출력하는 방법 - bitset (0) | 2023.04.19 |
Comments