mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-24 06:55:19 -07:00
CurrencyConverter:
- remove extra space at the end of the value with some locales and numbers - fix formatting issue
This commit is contained in:
parent
c6b770eec8
commit
2ee2583d3d
1 changed files with 4 additions and 2 deletions
|
@ -53,6 +53,7 @@ constexpr size_t SELECTED_TARGET_UNIT = 2;
|
||||||
|
|
||||||
// x millisecond delay before we consider conversion to be final
|
// x millisecond delay before we consider conversion to be final
|
||||||
constexpr unsigned int CONVERSION_FINALIZED_DELAY_IN_MS = 1000;
|
constexpr unsigned int CONVERSION_FINALIZED_DELAY_IN_MS = 1000;
|
||||||
|
const wregex regexTrimSpacesEnd = wregex(L"\\s+$");
|
||||||
|
|
||||||
namespace CalculatorApp::ViewModel
|
namespace CalculatorApp::ViewModel
|
||||||
{
|
{
|
||||||
|
@ -348,10 +349,11 @@ String^ UnitConverterViewModel::ConvertToLocalizedString(const std::wstring& str
|
||||||
if (pos != wstring::npos)
|
if (pos != wstring::npos)
|
||||||
{
|
{
|
||||||
currencyResult.erase(pos, currencyCode.length());
|
currencyResult.erase(pos, currencyCode.length());
|
||||||
pos = currencyResult.find(L'\u00a0'); // non-breaking space
|
std::wsmatch sm;
|
||||||
if (pos != wstring::npos)
|
if (regex_search(currencyResult, sm, regexTrimSpacesEnd))
|
||||||
{
|
{
|
||||||
currencyResult.erase(pos, 1);
|
currencyResult.erase(pos, 1);
|
||||||
|
currencyResult.erase(sm.prefix().length(), sm.length());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue