Fixes to Korean number representation

This commit is contained in:
Stephen Seo 2024-04-16 20:25:17 +09:00
parent 7b6a7c78d2
commit 8a47f3be5d

View file

@ -88,6 +88,10 @@ std::u8string value_to_korean(unsigned long long value) {
std::u8string s;
unsigned long long temp;
bool requires_uc = false;
bool requires_man = false;
if(temp = (value / 1000000000000) % 10; temp > 0) {
if(!s.empty()) { s.push_back(' '); }
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(temp != 1) { s.append(digit_to_kword(temp)); }
s.append(chun);
requires_uc = true;
}
if(temp = (value / 10000000000) % 10; temp > 0) {
if(!s.empty()) { s.push_back(' '); }
if(temp != 1) { s.append(digit_to_kword(temp)); }
s.append(bec);
requires_uc = true;
}
if(temp = (value / 1000000000) % 10; temp > 0) {
if(!s.empty()) { s.push_back(' '); }
if(temp != 1) { s.append(digit_to_kword(temp)); }
s.append(ship);
requires_uc = true;
}
if(temp = (value / 100000000) % 10; temp > 0) {
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);
} else if(!s.empty()) {
if(!s.empty()) { s.push_back(' '); }
s.append(il);
} else if (requires_uc) {
s.push_back(' ');
s.append(uc);
}
if(temp = (value / 10000000) % 10; temp > 0) {
if(!s.empty()) { s.push_back(' '); }
if(temp != 1) { s.append(digit_to_kword(temp)); }
s.append(chun);
requires_man = true;
}
if(temp = (value / 1000000) % 10; temp > 0) {
if(!s.empty()) { s.push_back(' '); }
if(temp != 1) { s.append(digit_to_kword(temp)); }
s.append(bec);
requires_man = true;
}
if(temp = (value / 100000) % 10; temp > 0) {
if(!s.empty()) { s.push_back(' '); }
if(temp != 1) { s.append(digit_to_kword(temp)); }
s.append(ship);
requires_man = true;
}
if(temp = (value / 10000) % 10; temp > 0) {
if(!s.empty()) { s.push_back(' '); }
if(temp != 1) { s.append(digit_to_kword(temp)); }
s.append(man);
} else if(!s.empty()) {
} else if (requires_man) {
s.push_back(' ');
s.append(man);
}
if(temp = (value / 1000) % 10; temp > 0) {