Fixes to Korean number representation
This commit is contained in:
parent
7b6a7c78d2
commit
8a47f3be5d
1 changed files with 15 additions and 5 deletions
20
src/main.cpp
20
src/main.cpp
|
@ -88,6 +88,10 @@ std::u8string value_to_korean(unsigned long long value) {
|
||||||
std::u8string s;
|
std::u8string s;
|
||||||
|
|
||||||
unsigned long long temp;
|
unsigned long long temp;
|
||||||
|
|
||||||
|
bool requires_uc = false;
|
||||||
|
bool requires_man = false;
|
||||||
|
|
||||||
if(temp = (value / 1000000000000) % 10; temp > 0) {
|
if(temp = (value / 1000000000000) % 10; temp > 0) {
|
||||||
if(!s.empty()) { s.push_back(' '); }
|
if(!s.empty()) { s.push_back(' '); }
|
||||||
if(temp != 1) { s.append(digit_to_kword(temp)); }
|
if(temp != 1) { s.append(digit_to_kword(temp)); }
|
||||||
|
@ -97,46 +101,52 @@ std::u8string value_to_korean(unsigned long long value) {
|
||||||
if(!s.empty()) { s.push_back(' '); }
|
if(!s.empty()) { s.push_back(' '); }
|
||||||
if(temp != 1) { s.append(digit_to_kword(temp)); }
|
if(temp != 1) { s.append(digit_to_kword(temp)); }
|
||||||
s.append(chun);
|
s.append(chun);
|
||||||
|
requires_uc = true;
|
||||||
}
|
}
|
||||||
if(temp = (value / 10000000000) % 10; temp > 0) {
|
if(temp = (value / 10000000000) % 10; temp > 0) {
|
||||||
if(!s.empty()) { s.push_back(' '); }
|
if(!s.empty()) { s.push_back(' '); }
|
||||||
if(temp != 1) { s.append(digit_to_kword(temp)); }
|
if(temp != 1) { s.append(digit_to_kword(temp)); }
|
||||||
s.append(bec);
|
s.append(bec);
|
||||||
|
requires_uc = true;
|
||||||
}
|
}
|
||||||
if(temp = (value / 1000000000) % 10; temp > 0) {
|
if(temp = (value / 1000000000) % 10; temp > 0) {
|
||||||
if(!s.empty()) { s.push_back(' '); }
|
if(!s.empty()) { s.push_back(' '); }
|
||||||
if(temp != 1) { s.append(digit_to_kword(temp)); }
|
if(temp != 1) { s.append(digit_to_kword(temp)); }
|
||||||
s.append(ship);
|
s.append(ship);
|
||||||
|
requires_uc = true;
|
||||||
}
|
}
|
||||||
if(temp = (value / 100000000) % 10; temp > 0) {
|
if(temp = (value / 100000000) % 10; temp > 0) {
|
||||||
if(!s.empty()) { s.push_back(' '); }
|
if(!s.empty()) { s.push_back(' '); }
|
||||||
if(temp != 1) { s.append(digit_to_kword(temp)); }
|
if (temp > 0) { s.append(digit_to_kword(temp)); }
|
||||||
s.append(uc);
|
s.append(uc);
|
||||||
} else if(!s.empty()) {
|
} else if (requires_uc) {
|
||||||
if(!s.empty()) { s.push_back(' '); }
|
s.push_back(' ');
|
||||||
s.append(il);
|
|
||||||
s.append(uc);
|
s.append(uc);
|
||||||
}
|
}
|
||||||
if(temp = (value / 10000000) % 10; temp > 0) {
|
if(temp = (value / 10000000) % 10; temp > 0) {
|
||||||
if(!s.empty()) { s.push_back(' '); }
|
if(!s.empty()) { s.push_back(' '); }
|
||||||
if(temp != 1) { s.append(digit_to_kword(temp)); }
|
if(temp != 1) { s.append(digit_to_kword(temp)); }
|
||||||
s.append(chun);
|
s.append(chun);
|
||||||
|
requires_man = true;
|
||||||
}
|
}
|
||||||
if(temp = (value / 1000000) % 10; temp > 0) {
|
if(temp = (value / 1000000) % 10; temp > 0) {
|
||||||
if(!s.empty()) { s.push_back(' '); }
|
if(!s.empty()) { s.push_back(' '); }
|
||||||
if(temp != 1) { s.append(digit_to_kword(temp)); }
|
if(temp != 1) { s.append(digit_to_kword(temp)); }
|
||||||
s.append(bec);
|
s.append(bec);
|
||||||
|
requires_man = true;
|
||||||
}
|
}
|
||||||
if(temp = (value / 100000) % 10; temp > 0) {
|
if(temp = (value / 100000) % 10; temp > 0) {
|
||||||
if(!s.empty()) { s.push_back(' '); }
|
if(!s.empty()) { s.push_back(' '); }
|
||||||
if(temp != 1) { s.append(digit_to_kword(temp)); }
|
if(temp != 1) { s.append(digit_to_kword(temp)); }
|
||||||
s.append(ship);
|
s.append(ship);
|
||||||
|
requires_man = true;
|
||||||
}
|
}
|
||||||
if(temp = (value / 10000) % 10; temp > 0) {
|
if(temp = (value / 10000) % 10; temp > 0) {
|
||||||
if(!s.empty()) { s.push_back(' '); }
|
if(!s.empty()) { s.push_back(' '); }
|
||||||
if(temp != 1) { s.append(digit_to_kword(temp)); }
|
if(temp != 1) { s.append(digit_to_kword(temp)); }
|
||||||
s.append(man);
|
s.append(man);
|
||||||
} else if(!s.empty()) {
|
} else if (requires_man) {
|
||||||
|
s.push_back(' ');
|
||||||
s.append(man);
|
s.append(man);
|
||||||
}
|
}
|
||||||
if(temp = (value / 1000) % 10; temp > 0) {
|
if(temp = (value / 1000) % 10; temp > 0) {
|
||||||
|
|
Loading…
Reference in a new issue