Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

use index from end expressions #1431

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ string Convert(int number, bool isOrdinal)
}
else if (isOrdinal)
{
parts[parts.Count - 1] += "ste";
parts[^1] += "ste";
}

var toWords = string.Join(" ", parts);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ string ConvertImpl(long number, bool isOrdinal)
}
else if (isOrdinal)
{
parts[parts.Count - 1] += "երորդ";
parts[^1] += "երորդ";
}

var toWords = string.Join(" ", parts);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public override string ConvertToOrdinal(int number)
}
}

if (word[word.Length - 1] == 't')
if (word[^1] == 't')
{
word = word.Substring(0, word.Length - 1) + 'd';
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ static string Convert(long input, GrammaticalGender gender, bool isOrdinal, bool
}

if (isOrdinal && !string.IsNullOrWhiteSpace(lastOrdinalSubstitution))
parts[parts.Count - 1] = lastOrdinalSubstitution;
parts[^1] = lastOrdinalSubstitution;

return string.Join(" ", parts);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public override string Convert(long number)
public override string ConvertToOrdinal(int number)
{
var word = Convert(number);
return $"{word}{(IsVowel(word[word.Length - 1]) ? "یەم" : "ەم")}";
return $"{word}{(IsVowel(word[^1]) ? "یەم" : "ەم")}";
}

static bool IsVowel(char c) =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ string Convert(long number, bool isOrdinal, bool addAnd = true)
}
else if (isOrdinal)
{
parts[parts.Count - 1] += "th";
parts[^1] += "th";
}

var toWords = string.Join(" ", parts);
Expand Down