BLC 사용 예제 - ㅇ을 ㅁ으로 변경하기
BLC 라이브러리 다운로드
입력받은 문자열에서 모든 'ㅇ'을 'ㅁ'으로 바꿔주는 예제 코드입니다.
예제 코드 보기
- #include
- #include
-
- #include
- #include
-
- int main()
- {
- using namespace blc::console;
- using namespace blc::han;
- using namespace blc::ustr;
- using namespace std;
-
- SetCharacterWidthFunc(mk_wcwidth_cjk);
-
-
- ConsoleWindow::SetTitle(L"\'ㅇ\'을 \'ㅁ\'으로 바꾸는 예제"s);
-
- auto str = u8""s;
- ConsoleWindow::Space space(0, 0, 60, 1);
-
- cout << u8"입력한 문자열의 \'ㅇ\'을 모두 \'ㅁ\'으로 바꿉니다."s << endl << endl;
- space.set_y(ConsoleWindow::WhereY());
-
- ConsoleWindow::ModifyStr(str, space);
- cout << endl << endl;
-
- const HangulJamo<Onset> old_onset(U'ㅇ'), new_onset(U'ㅁ');
- const HangulJamo<Coda> old_coda(U'ㅇ'), new_coda(U'ㅁ');
- const HangulJamo<Nucleus> invalid_nucleus;
-
- str = ReplaceAllJamo(
- str,
- old_onset, invalid_nucleus, old_coda,
- new_onset, invalid_nucleus, new_coda
- );
- cout << str << endl << endl;
-
- return 0;
- }
예제 코드 접기
실행 결과
