mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 15:22:55 +08:00
Use StringSplitOptions.TrimEntries for string.Split() when possible
This commit is contained in:
parent
38a674cd84
commit
182f36c434
@ -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] }
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -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>
|
||||
(
|
||||
|
Loading…
Reference in New Issue
Block a user