mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-01-15 15:48:03 +00:00
Optimize StringHelper.ToFirstUpper()
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
namespace MediaBrowser.Model.Extensions
|
namespace MediaBrowser.Model.Extensions
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -25,14 +27,11 @@ namespace MediaBrowser.Model.Extensions
|
|||||||
|
|
||||||
return string.Create(
|
return string.Create(
|
||||||
str.Length,
|
str.Length,
|
||||||
str,
|
str.AsSpan(),
|
||||||
(chars, buf) =>
|
(chars, buf) =>
|
||||||
{
|
{
|
||||||
chars[0] = char.ToUpperInvariant(buf[0]);
|
chars[0] = char.ToUpperInvariant(buf[0]);
|
||||||
for (int i = 1; i < chars.Length; i++)
|
buf.Slice(1).CopyTo(chars.Slice(1));
|
||||||
{
|
|
||||||
chars[i] = buf[i];
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user