Changeset View
Changeset View
Standalone View
Standalone View
src/util/moneystr.cpp
Show All 29 Lines | std::string FormatMoney(const Amount amt) { | ||||
} | } | ||||
return str; | return str; | ||||
} | } | ||||
bool ParseMoney(const std::string &str, Amount &nRet) { | bool ParseMoney(const std::string &str, Amount &nRet) { | ||||
if (!ValidAsCString(str)) { | if (!ValidAsCString(str)) { | ||||
return false; | return false; | ||||
} | } | ||||
return ParseMoney(str.c_str(), nRet); | |||||
if (str.empty()) { | |||||
return false; | |||||
} | } | ||||
bool ParseMoney(const char *pszIn, Amount &nRet) { | |||||
std::string strWhole; | std::string strWhole; | ||||
Amount nUnits = Amount::zero(); | Amount nUnits = Amount::zero(); | ||||
const char *p = pszIn; | const char *p = str.c_str(); | ||||
while (IsSpace(*p)) { | while (IsSpace(*p)) { | ||||
p++; | p++; | ||||
} | } | ||||
for (; *p; p++) { | for (; *p; p++) { | ||||
if (*p == '.') { | if (*p == '.') { | ||||
p++; | p++; | ||||
Amount nMult = COIN / 10; | Amount nMult = COIN / 10; | ||||
while (IsDigit(*p) && (nMult > Amount::zero())) { | while (IsDigit(*p) && (nMult > Amount::zero())) { | ||||
Show All 31 Lines |