Changeset View
Changeset View
Standalone View
Standalone View
src/qt/bitcoinunits.cpp
Show First 20 Lines • Show All 121 Lines • ▼ Show 20 Lines | QString BitcoinUnits::format(int unit, const Amount nIn, bool fPlus, | ||||
if (justify) { | if (justify) { | ||||
quotient_str = quotient_str.rightJustified(16 - num_decimals, ' '); | quotient_str = quotient_str.rightJustified(16 - num_decimals, ' '); | ||||
} | } | ||||
// Use SI-style thin space separators as these are locale independent and | // Use SI-style thin space separators as these are locale independent and | ||||
// can't be confused with the decimal marker. | // can't be confused with the decimal marker. | ||||
QChar thin_sp(THIN_SP_CP); | QChar thin_sp(THIN_SP_CP); | ||||
int q_size = quotient_str.size(); | int q_size = quotient_str.size(); | ||||
if (separators == separatorAlways || | if (separators == SeparatorStyle::ALWAYS || | ||||
(separators == separatorStandard && q_size > 4)) { | (separators == SeparatorStyle::STANDARD && q_size > 4)) { | ||||
for (int i = 3; i < q_size; i += 3) { | for (int i = 3; i < q_size; i += 3) { | ||||
quotient_str.insert(q_size - i, thin_sp); | quotient_str.insert(q_size - i, thin_sp); | ||||
} | } | ||||
} | } | ||||
if (n < 0) { | if (n < 0) { | ||||
quotient_str.insert(0, '-'); | quotient_str.insert(0, '-'); | ||||
} else if (fPlus && n > 0) { | } else if (fPlus && n > 0) { | ||||
▲ Show 20 Lines • Show All 120 Lines • Show Last 20 Lines |