Skip to content

Commit

Permalink
Use StartsWith() instead of IndexOf() == 0
Browse files Browse the repository at this point in the history
  • Loading branch information
dahlbyk committed Apr 30, 2021
1 parent d90b040 commit 9a6f1f7
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ private static string GetUnitValue(int number, bool isOrdinal)
private static string RemoveOnePrefix(string toWords)
{
// one hundred => hundredth
if (toWords.IndexOf("een", StringComparison.Ordinal) == 0)
if (toWords.StartsWith("een", StringComparison.Ordinal))
{
if (toWords.IndexOf("een en", StringComparison.Ordinal) != 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ private static string GetUnitValue(long number, bool isOrdinal)
private static string RemoveOnePrefix(string toWords)
{
// one hundred => hundredth
if (toWords.IndexOf("մեկ", StringComparison.Ordinal) == 0)
if (toWords.StartsWith("մեկ", StringComparison.Ordinal))
{
toWords = toWords.Remove(0, 4);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ private static string GetUnitValue(long number, bool isOrdinal)
private static string RemoveOnePrefix(string toWords)
{
// one hundred => hundredth
if (toWords.IndexOf("one", StringComparison.Ordinal) == 0)
if (toWords.StartsWith("one", StringComparison.Ordinal))
{
toWords = toWords.Remove(0, 4);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ private static string GetHundredsValue(ref long number)
private static string RemoveOnePrefix(string toWords)
{
// one hundred => hundredth
if (toWords.IndexOf("one", StringComparison.Ordinal) == 0)
if (toWords.StartsWith("one", StringComparison.Ordinal))
toWords = toWords.Remove(0, 4);

return toWords;
Expand Down

0 comments on commit 9a6f1f7

Please sign in to comment.