일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
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 |
Tags
- 주일설교
- Deep learning
- 빅 데이터
- 통계
- 딥러닝
- 빅데이터
- 우리들교회
- 몽고디비
- 빅 데이타
- c++
- WebGL
- 빅데이타
- R
- data science
- nodeJS
- 김양재 목사
- Machine Learning
- 데이터 과학
- 김양재
- 확률
- Artificial Intelligence
- Big Data
- Statistics
- No SQL
- probability
- 김양재 목사님
- openCV
- 인공지능
- MongoDB
- node.js
Archives
- Today
- Total
Scientific Computing & Data Science
[C/C++] MFC / CString의 한글/영문/숫자 구별하기 본문
이번 글에서는 MFC에서 CString으로 입력 받은 문자열의 첫번째 문자가 한글인지 영문인지 숫자인지 알아내는 코드를 소개하고자 한다.
[한글 알아내기]
CString str = _T("ㄱ");
if(0 >= str.GetAt(0) || 127 < str.GetAt(0)) AfxMessageBox(_T("This is Hangeul"));
[영문 알아내기]
CString str = _T("a");
if(isalpha(str.GetAt(0))) AfxMessageBox(_T("This is an Alphabet"));
또는
CString str = _T("a");
if((65 <= str.GetAt(0) && str.GetAt(0) <= 90) || (97 <= str.GetAt(0) && str.GetAt(0) <= 122)) AfxMessageBox(_T("This is an Alphabet"));
[숫자 알아내기]
CString str = _T("3");
if(isdigit(str.GetAt(0))) AfxMessageBox(_T("This is a Numeric"));
또는
CString str = _T("3"); if(48 <= str.GetAt(0) && str.GetAt(0) <= 57) AfxMessageBox(_T("This is a Numeric"));
'Programming > C&C++' 카테고리의 다른 글
[C/C++] MFC / CString과 std::string 타입 변환 (0) | 2014.09.01 |
---|---|
[C/C++] MFC / Edit Control Cursor (0) | 2014.08.19 |
[C/C++] MFC / Edit Control에서 알파벳과 숫자만 허용하기 (1) | 2014.07.10 |
[C/C++] MFC / Edit Control 박스 입력된 글자수 검출하기 (0) | 2014.07.07 |
[C/C++] MFC / Edit Control 박스 입력 가능 글자수 제한하기 (1) | 2014.07.07 |
Comments