1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-26 16:12:54 +08:00

Merge pull request #21809 from turbedi/split_trimentries

Use StringSplitOptions.TrimEntries in string.Split() when possible
This commit is contained in:
Bartłomiej Dach 2022-12-27 18:42:48 +01:00 committed by GitHub
commit b4a3f872ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 11 deletions

View File

@ -45,7 +45,7 @@ namespace osu.Game.Tournament.Screens.Drawings.Components
continue;
// ReSharper disable once PossibleNullReferenceException
string[] split = line.Split(':');
string[] split = line.Split(':', StringSplitOptions.TrimEntries);
if (split.Length < 2)
{
@ -55,9 +55,9 @@ namespace osu.Game.Tournament.Screens.Drawings.Components
teams.Add(new TournamentTeam
{
FullName = { Value = split[1].Trim(), },
Acronym = { Value = split.Length >= 3 ? split[2].Trim() : null, },
FlagName = { Value = split[0].Trim() }
FullName = { Value = split[1], },
Acronym = { Value = split.Length >= 3 ? split[2] : null, },
FlagName = { Value = split[0] }
});
}
}

View File

@ -132,13 +132,7 @@ namespace osu.Game.Beatmaps.Formats
protected KeyValuePair<string, string> SplitKeyVal(string line, char separator = ':', bool shouldTrim = true)
{
string[] split = line.Split(separator, 2);
if (shouldTrim)
{
for (int i = 0; i < split.Length; i++)
split[i] = split[i].Trim();
}
string[] split = line.Split(separator, 2, shouldTrim ? StringSplitOptions.TrimEntries : StringSplitOptions.None);
return new KeyValuePair<string, string>
(