PIbd-22_Bazunov_AI_Hotel/Hotel/HotelView/Utils/StringExtensions.cs

12 lines
422 B
C#
Raw Normal View History

2023-05-19 17:52:18 +04:00
namespace HotelView.Utils;
public static class StringExtensions
{
public static string FirstCharToUpper(this string input) =>
input switch
{
null => throw new ArgumentNullException(nameof(input)),
"" => throw new ArgumentException($"{nameof(input)} cannot be empty", nameof(input)),
_ => string.Concat(input[0].ToString().ToUpper(), input.AsSpan(1))
};
}