mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-23 06:25:19 -07:00
Remove exponent value from operand length
This commit is contained in:
parent
b5dc971bf4
commit
bb18205d45
1 changed files with 13 additions and 4 deletions
|
@ -502,23 +502,32 @@ ULONG32 CopyPasteManager::StandardScientificOperandLength(Platform::String ^ ope
|
||||||
{
|
{
|
||||||
auto operandWstring = wstring(operand->Data());
|
auto operandWstring = wstring(operand->Data());
|
||||||
const bool hasDecimal = operandWstring.find('.') != wstring::npos;
|
const bool hasDecimal = operandWstring.find('.') != wstring::npos;
|
||||||
|
auto length = operandWstring.length();
|
||||||
|
|
||||||
if (hasDecimal)
|
if (hasDecimal)
|
||||||
{
|
{
|
||||||
if (operandWstring.length() >= 2)
|
if (length >= 2)
|
||||||
{
|
{
|
||||||
if ((operandWstring[0] == L'0') && (operandWstring[1] == L'.'))
|
if ((operandWstring[0] == L'0') && (operandWstring[1] == L'.'))
|
||||||
{
|
{
|
||||||
return static_cast<ULONG32>(operandWstring.length() - 2);
|
length -= 2;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return static_cast<ULONG32>(operandWstring.length() - 1);
|
length -= 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return static_cast<ULONG32>(operandWstring.length());
|
auto exponentPos = operandWstring.find('e');
|
||||||
|
const bool hasExponent = exponentPos != wstring::npos;
|
||||||
|
if (hasExponent)
|
||||||
|
{
|
||||||
|
auto expLength = operandWstring.substr(exponentPos).length();
|
||||||
|
length -= expLength;
|
||||||
|
}
|
||||||
|
|
||||||
|
return static_cast<ULONG32>(length);
|
||||||
}
|
}
|
||||||
|
|
||||||
ULONG32 CopyPasteManager::ProgrammerOperandLength(Platform::String ^ operand, NumberBase numberBase)
|
ULONG32 CopyPasteManager::ProgrammerOperandLength(Platform::String ^ operand, NumberBase numberBase)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue