1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-28 06:42:54 +08:00

Remove allocation of string.IndexOf()

This commit is contained in:
smoogipoo 2018-10-11 18:09:19 +09:00
parent bd99a87298
commit 5b544a0c97

View File

@ -69,7 +69,9 @@ namespace osu.Game.Beatmaps.Formats
protected string StripComments(string line)
{
var index = line.IndexOf("//", StringComparison.Ordinal);
const string comment_prefix = "//";
var index = line.AsSpan().IndexOf(comment_prefix.AsSpan());
if (index > 0)
return line.Substring(0, index);
return line;