mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 19:03:08 +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;
|
continue;
|
||||||
|
|
||||||
// ReSharper disable once PossibleNullReferenceException
|
// ReSharper disable once PossibleNullReferenceException
|
||||||
string[] split = line.Split(':');
|
string[] split = line.Split(':', StringSplitOptions.TrimEntries);
|
||||||
|
|
||||||
if (split.Length < 2)
|
if (split.Length < 2)
|
||||||
{
|
{
|
||||||
@ -55,9 +55,9 @@ namespace osu.Game.Tournament.Screens.Drawings.Components
|
|||||||
|
|
||||||
teams.Add(new TournamentTeam
|
teams.Add(new TournamentTeam
|
||||||
{
|
{
|
||||||
FullName = { Value = split[1].Trim(), },
|
FullName = { Value = split[1], },
|
||||||
Acronym = { Value = split.Length >= 3 ? split[2].Trim() : null, },
|
Acronym = { Value = split.Length >= 3 ? split[2] : null, },
|
||||||
FlagName = { Value = split[0].Trim() }
|
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)
|
protected KeyValuePair<string, string> SplitKeyVal(string line, char separator = ':', bool shouldTrim = true)
|
||||||
{
|
{
|
||||||
string[] split = line.Split(separator, 2);
|
string[] split = line.Split(separator, 2, shouldTrim ? StringSplitOptions.TrimEntries : StringSplitOptions.None);
|
||||||
|
|
||||||
if (shouldTrim)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < split.Length; i++)
|
|
||||||
split[i] = split[i].Trim();
|
|
||||||
}
|
|
||||||
|
|
||||||
return new KeyValuePair<string, string>
|
return new KeyValuePair<string, string>
|
||||||
(
|
(
|
||||||
|
Loading…
Reference in New Issue
Block a user