mirror of
https://github.com/Microsoft/calculator.git
synced 2025-08-22 06:13:14 -07:00
Use array instead of substring
This commit is contained in:
parent
3026c8f800
commit
7b6ff153f6
2 changed files with 4 additions and 4 deletions
|
@ -17,12 +17,12 @@ namespace CalculatorUITestFramework
|
|||
public string GetValue()
|
||||
{
|
||||
var equalSignIndex = Item.Text.IndexOf("=");
|
||||
return Item.Text.Substring(equalSignIndex + 1).Trim();
|
||||
return Item.Text[(equalSignIndex + 1)..].Trim();
|
||||
}
|
||||
public string GetExpression()
|
||||
{
|
||||
var equalSignIndex = Item.Text.IndexOf("=");
|
||||
return Item.Text.Substring(0, equalSignIndex + 1).Trim();
|
||||
return Item.Text[..(equalSignIndex + 1)].Trim();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,7 +34,7 @@ namespace CalculatorUITestFramework
|
|||
string numberStr = number.ToString(CultureInfo.InvariantCulture);
|
||||
if (numberStr.StartsWith("-"))
|
||||
{
|
||||
numberStr = numberStr.Substring(1) + "-";
|
||||
numberStr = numberStr[1..] + "-";
|
||||
}
|
||||
foreach (char digit in numberStr)
|
||||
{
|
||||
|
@ -77,7 +77,7 @@ namespace CalculatorUITestFramework
|
|||
this.NegateButton.Click();
|
||||
break;
|
||||
default:
|
||||
throw (new ArgumentException(string.Format("{0} is not valid", digit)));
|
||||
throw (new ArgumentException($"{digit} is not valid"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue