
IntlChar::isspace 함수는 Unicode 표준에 따라 공백 문자를 판단합니다.
공백 문자는 다음과 같습니다.
- 공백 문자 (U+0020)
- 탭 문자 (U+0009)
- 줄 바꿈 문자 (U+000A)
- 폼 피드 문자 (U+000C)
- 비스무리 문자 (U+000B)
- 인덴트 문자 (U+000D)
- 제어 문자 (U+0085)
특정 언어의 문자가 공백인지 아닌지를 판단할 때는, Unicode 표준에 따라 판단합니다.
예를 들어, 한글의 경우, 공백 문자는 U+3000 (한자 공백)과 U+2007 (한자 공백)입니다.
IntlChar::isspace 함수의 사용 예는 다음과 같습니다.
#hostingforum.kr
cpp
#include
#include
#include
int main() {
icu::UnicodeString str;
str = "Hello, World!";
icu::UnicodeString::Iterator iter(str);
while (iter.hasNext()) {
icu::UChar32 c = iter.next();
if (icu::UnicodeCharacterIterator::isspace(c)) {
std::cout << "공백 문자입니다." << std::endl;
} else {
std::cout << "공백이 아닙니다." << std::endl;
}
}
return 0;
}
이 예제에서는, "Hello, World!" 문자열의 각 문자가 공백인지 아닌지를 판단합니다.
2025-05-06 10:11