2020-12-05 11:12:55 +01:00
|
|
|
// Copyright (c) Umbraco.
|
|
|
|
|
// See LICENSE for more details.
|
|
|
|
|
|
2022-06-21 08:09:38 +02:00
|
|
|
namespace Umbraco.Cms.Tests.Common.Builders.Extensions;
|
|
|
|
|
|
|
|
|
|
public static class StringExtensions
|
2020-03-29 16:17:06 +02:00
|
|
|
{
|
2022-06-21 08:09:38 +02:00
|
|
|
public static string ToCamelCase(this string s)
|
2020-03-29 16:17:06 +02:00
|
|
|
{
|
2022-06-21 08:09:38 +02:00
|
|
|
if (string.IsNullOrWhiteSpace(s))
|
2020-03-29 16:17:06 +02:00
|
|
|
{
|
2022-06-21 08:09:38 +02:00
|
|
|
return string.Empty;
|
|
|
|
|
}
|
2020-03-29 16:17:06 +02:00
|
|
|
|
2022-06-21 08:09:38 +02:00
|
|
|
if (s.Length == 1)
|
|
|
|
|
{
|
|
|
|
|
return s.ToLowerInvariant();
|
2020-03-29 16:17:06 +02:00
|
|
|
}
|
2022-06-21 08:09:38 +02:00
|
|
|
|
|
|
|
|
return char.ToLowerInvariant(s[0]) + s.Substring(1);
|
2020-03-29 16:17:06 +02:00
|
|
|
}
|
|
|
|
|
}
|