Skip to content

Commit efddc2c

Browse files
committed
some more lowercase fun
1 parent 2a74de2 commit efddc2c

File tree

3 files changed

+10
-13
lines changed

3 files changed

+10
-13
lines changed

Packages/com.unity.inputsystem/InputSystem/Controls/InputControlPath.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -559,15 +559,15 @@ private static bool StringMatches(Substring str, InternedString matchTo)
559559
return true; // Wildcard at end of string so rest is matched.
560560

561561
++posInStr;
562-
nextChar = char.ToLower(str[posInStr], CultureInfo.InvariantCulture);
562+
nextChar = char.ToLowerInvariant(str[posInStr]);
563563

564564
while (posInMatchTo < matchToLength && matchToLowerCase[posInMatchTo] != nextChar)
565565
++posInMatchTo;
566566

567567
if (posInMatchTo == matchToLength)
568568
return false; // Matched all the way to end of matchTo but there's more in str after the wildcard.
569569
}
570-
else if (char.ToLower(nextChar, CultureInfo.InvariantCulture) != matchToLowerCase[posInMatchTo])
570+
else if (char.ToLowerInvariant(nextChar) != matchToLowerCase[posInMatchTo])
571571
{
572572
return false;
573573
}
@@ -1156,7 +1156,7 @@ private static bool MatchPathComponent(string component, string path, ref int in
11561156
}
11571157

11581158
var charInComponent = component[indexInComponent];
1159-
if (charInComponent == nextCharInPath || char.ToLower(charInComponent, CultureInfo.InvariantCulture) == char.ToLower(nextCharInPath, CultureInfo.InvariantCulture))
1159+
if (charInComponent == nextCharInPath || char.ToLowerInvariant(charInComponent) == char.ToLowerInvariant(nextCharInPath))
11601160
{
11611161
++indexInComponent;
11621162
++indexInPath;

Packages/com.unity.inputsystem/InputSystem/Controls/KeyControl.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,18 @@ protected override void RefreshConfiguration()
7777
return;
7878
}
7979

80-
var textInfo = CultureInfo.InvariantCulture.TextInfo;
8180
// We need to lower case first because ToTitleCase preserves upper casing.
8281
// For example on Swedish Windows layout right shift display name is "HÖGER SKIFT".
8382
// Just passing it to ToTitleCase won't change anything. But passing "höger skift" will return "Höger Skift".
84-
var keyNameLowerCase = textInfo.ToLower(rawKeyName);
83+
var keyNameLowerCase = rawKeyName.ToLowerInvariant();
84+
8585
if (string.IsNullOrEmpty(keyNameLowerCase))
8686
{
8787
displayName = rawKeyName;
8888
return;
8989
}
9090

91+
var textInfo = CultureInfo.InvariantCulture.TextInfo;
9192
displayName = textInfo.ToTitleCase(keyNameLowerCase);
9293
}
9394
}

Packages/com.unity.inputsystem/InputSystem/Utilities/InternedString.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -171,26 +171,22 @@ public override string ToString()
171171

172172
public static bool operator==(InternedString a, string b)
173173
{
174-
return string.Compare(a.m_StringLowerCase, b.ToLower(CultureInfo.InvariantCulture),
175-
StringComparison.InvariantCultureIgnoreCase) == 0;
174+
return string.Compare(a.m_StringLowerCase, b, StringComparison.InvariantCultureIgnoreCase) == 0;
176175
}
177176

178177
public static bool operator!=(InternedString a, string b)
179178
{
180-
return string.Compare(a.m_StringLowerCase, b.ToLower(CultureInfo.InvariantCulture),
181-
StringComparison.InvariantCultureIgnoreCase) != 0;
179+
return string.Compare(a.m_StringLowerCase, b, StringComparison.InvariantCultureIgnoreCase) != 0;
182180
}
183181

184182
public static bool operator==(string a, InternedString b)
185183
{
186-
return string.Compare(a.ToLower(CultureInfo.InvariantCulture), b.m_StringLowerCase,
187-
StringComparison.InvariantCultureIgnoreCase) == 0;
184+
return string.Compare(a, b.m_StringLowerCase, StringComparison.InvariantCultureIgnoreCase) == 0;
188185
}
189186

190187
public static bool operator!=(string a, InternedString b)
191188
{
192-
return string.Compare(a.ToLower(CultureInfo.InvariantCulture), b.m_StringLowerCase,
193-
StringComparison.InvariantCultureIgnoreCase) != 0;
189+
return string.Compare(a, b.m_StringLowerCase, StringComparison.InvariantCultureIgnoreCase) != 0;
194190
}
195191

196192
public static bool operator<(InternedString left, InternedString right)

0 commit comments

Comments
 (0)