Skip to content

Commit

Permalink
remove redundant variable assignments (#1369)
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonCropp authored Feb 16, 2024
1 parent 382960c commit 8ed6808
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,7 @@ private string ConvertIntBH(long number, bool returnPluralized)

private string ConvertIntBT(long number, bool returnPluralized)
{
var result = "";
string result;

if (number / 100 == 1)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public override string Convert(long input, GrammaticalGender gender, bool addAnd

if (number / 1000000 > 0)
{
var millionPart = "";
string millionPart;
if (number == 1000000)
{
millionPart = "miljons";
Expand All @@ -34,7 +34,7 @@ public override string Convert(long input, GrammaticalGender gender, bool addAnd

if (number / 1000 > 0)
{
var thousandsPart = "";
string thousandsPart;
if (number == 1000)
{
thousandsPart = "tūkstotis";
Expand All @@ -53,7 +53,7 @@ public override string Convert(long input, GrammaticalGender gender, bool addAnd

if (number / 100 > 0)
{
var hundredsPart = "";
string hundredsPart;
if (number == 100)
{
hundredsPart = parts.Contains("tūkstoš") ? "viens simts" : "simts";
Expand Down Expand Up @@ -104,7 +104,7 @@ public override string ConvertToOrdinal(int input, GrammaticalGender gender)

if (number / 1000000 > 0)
{
var millionPart = "";
string millionPart;
if (number == 1000000)
{
millionPart = "miljon" + GetOrdinalEndingForGender(gender);
Expand All @@ -119,7 +119,7 @@ public override string ConvertToOrdinal(int input, GrammaticalGender gender)

if (number / 1000 > 0)
{
var thousandsPart = "";
string thousandsPart;
if (number % 1000 == 0)
{
if (number == 1000)
Expand Down Expand Up @@ -148,7 +148,7 @@ public override string ConvertToOrdinal(int input, GrammaticalGender gender)

if (number / 100 > 0)
{
var hundredsPart = "";
string hundredsPart;
if (number % 100 == 0)
{
hundredsPart = HundredsMap[number / 100] + GetOrdinalEndingForGender(gender);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ private static string GetHundreds(long value, bool usePrefixMap, bool usePrefixM
var tens = value % 100;
var numberOfHundreds = value / 100;

var hundredsText = string.Empty;
string hundredsText;
if (numberOfHundreds == 1)
{
hundredsText = "mija";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -236,25 +236,22 @@ private static string GetThousandsValue(ref long number)
}
private static string GetHundredsValue(ref long number)
{
var local_word = "";
var local_word = HundredsMap[number / 100 - 1];
if (number / 100 == 9)
{
local_word = HundredsMap[number / 100 - 1];
if (number / 100 == 9)
{
if (number % 100 == 0)
local_word += "ம்";
else
local_word += "த்து";
}
else if (number % 100 >= 1)
local_word += "ற்று";
if (number % 100 == 0)
local_word += "ம்";
else
local_word += "று";
local_word += "த்து";
}
else if (number % 100 >= 1)
local_word += "ற்று";
else
local_word += "று";

number %= 100;
number %= 100;

return local_word;
}
return local_word;
}

private static string RemoveOnePrefix(string toWords)
Expand Down

0 comments on commit 8ed6808

Please sign in to comment.