BLC 사용 예제 - 초성체 생성기
BLC 라이브러리 다운로드
입력받은 문자열을 초성체로 바꿔주는 예제 코드입니다.
예제 코드 보기
- #include
- #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& tbl = JamoTable::GetCompatibilityTable();
- HangulJamo<Onset> onset;
- Mchar<encoding::UTF8> mch;
-
- 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;
-
- for (size_t i = 0; i < str.length();) {
- NextChar(str, mch, i);
- onset.Disassemble(mch.GetUnicode());
- if (onset.IsValidCode()) {
- mch = onset.GetUnicode(tbl);
- }
- cout << mch;
- }
- cout << endl << endl;
-
- return 0;
- }
예제 코드 접기
실행 결과
