Added support for pasting of monetary values (#176)

Fixes #52

Description of the changes:
Added support for pasting of prefix currency symbols supported by the Windows keyboard.
yen or yuan (¥)
unspecified currency sign (¤)
Ghanaian cedi (₵)
dollar or peso ($)
colón (₡)
won (₩)
shekel (₪)
naira (₦)
Indian rupee (₹)
pound (£)
euro (€)

How changes were validated:
Manually tested each prefix currency symbol supported by the Windows keyboard and ran unit tests.
This commit is contained in:
Brandon Williams 2019-03-15 17:45:49 -07:00 committed by Daniel Belcher
parent ca15f05227
commit 4a41e37c87
5 changed files with 49 additions and 11 deletions

View file

@ -139,7 +139,7 @@ String^ CopyPasteManager::ValidatePasteExpression(String^ pastedText, ViewMode m
String^ englishString = LocalizationSettings::GetInstance().GetEnglishValueFromLocalizedDigits(pasteExpression);
// Removing the spaces, comma separator from the pasteExpression to allow pasting of expressions like 1 + 2+1,333
pasteExpression = Utils::RemoveUnwantedCharsFromWstring(englishString->Data());
pasteExpression = RemoveUnwantedCharsFromWstring(englishString->Data());
// If the last character is an = sign, remove it from the pasteExpression to allow evaluating the result on paste.
if (!pasteExpression.empty() && pasteExpression.back() == L'=')
@ -567,3 +567,21 @@ size_t CopyPasteManager::ProgrammerOperandLength(const wstring& operand, int num
return len;
}
// return wstring after removing characters like space, comma, double quotes, and monetary prefix currency symbols supported by the Windows keyboard:
// yen or yuan(¥) - 165
// unspecified currency sign(¤) - 164
// Ghanaian cedi(₵) - 8373
// dollar or peso($) - 36
// colón(₡) - 8353
// won(₩) - 8361
// shekel(₪) - 8362
// naira(₦) - 8358
// Indian rupee(₹) - 8377
// pound(£) - 163
// euro(€) - 8364
wstring CopyPasteManager::RemoveUnwantedCharsFromWstring(const wstring& input)
{
wchar_t unWantedChars[] = { L' ', L',', L'"', 165, 164, 8373, 36, 8353, 8361, 8362, 8358, 8377, 163, 8364, 8234, 8235, 8236, 8237 };
return Utils::RemoveUnwantedCharsFromWstring(input, unWantedChars, 18);
}