Skip to content

Commit

Permalink
Revert "Use range operator instead of substring method"
Browse files Browse the repository at this point in the history
This reverts commit 5b838ba.
  • Loading branch information
superrnovae committed Mar 5, 2024
1 parent 5b838ba commit 9fe58ed
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions main/SS/UserModel/DataFormatter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -191,9 +191,7 @@ static DataFormatter()
/** stores if the locale should change according to {@link LocaleUtil#getUserLocale()} */
private readonly bool localeIsAdapting;

/// <summary>
/// Whether years in dates should be displayed with 4 digits even if the formatString specifies only 2
/// </summary>
/** whether years in dates should be displayed with 4 digits even if the formatString specifies only 2 **/
public bool Use4DigitYearsInAllDateFormats { get; set; } = false;

/// <summary>
Expand Down Expand Up @@ -428,7 +426,6 @@ private FormatBase CreateFormat(double cellValue, int formatIndex, string sForma

// Strip off the locale information, we use an instance-wide locale for everything
MatchCollection matches = Regex.Matches(formatStr, localePatternGroup);

foreach (Match match in matches)
{
string matchedstring = match.Value;
Expand Down Expand Up @@ -524,8 +521,8 @@ string AdjustTo4DigitYearsIfConfigured(string format)

if(ypos4 == ypos2)
{
string part1 = format[..(ypos2 + 4)];
string part2 = format[(ypos2 + 4)..];
string part1 = format.Substring(0, ypos2 + 4);
string part2 = format.Substring(ypos2 + 4);
return part1 + AdjustTo4DigitYearsIfConfigured(part2);
}
else if(ypos3 == ypos2)
Expand All @@ -534,8 +531,8 @@ string AdjustTo4DigitYearsIfConfigured(string format)
}
else
{
string part1 = format[..(ypos2 + 2)];
string part2 = format[(ypos2 + 2)..];
string part1 = format.Substring(0, ypos2 + 2);
string part2 = format.Substring(ypos2 + 2);

return part1 + "yy" + AdjustTo4DigitYearsIfConfigured(part2);
}
Expand Down

0 comments on commit 9fe58ed

Please sign in to comment.