| | 1 | | using System.Diagnostics.CodeAnalysis; |
| | 2 | |
|
| | 3 | | namespace Plainquire.Filter; |
| | 4 | |
|
| | 5 | | /// <summary> |
| | 6 | | /// Extension methods for <see cref="string"/>. |
| | 7 | | /// </summary> |
| | 8 | | internal static class StringExtensions |
| | 9 | | { |
| | 10 | | /// <summary> |
| | 11 | | /// Lower-cases the first character. |
| | 12 | | /// </summary> |
| | 13 | | /// <param name="value">The value.</param> |
| | 14 | | [return: NotNullIfNotNull(nameof(value))] |
| | 15 | | public static string? LowercaseFirstChar(this string? value) |
| 47 | 16 | | => !string.IsNullOrEmpty(value) |
| 47 | 17 | | ? char.ToLowerInvariant(value[0]) + value[1..] |
| 47 | 18 | | : value; |
| | 19 | |
|
| | 20 | | /// <summary> |
| | 21 | | /// Upper-cases the first character. |
| | 22 | | /// </summary> |
| | 23 | | /// <param name="value">The value.</param> |
| | 24 | | [return: NotNullIfNotNull(nameof(value))] |
| | 25 | | public static string? UppercaseFirstChar(this string? value) |
| 3 | 26 | | => !string.IsNullOrEmpty(value) |
| 3 | 27 | | ? char.ToUpperInvariant(value[0]) + value[1..] |
| 3 | 28 | | : value; |
| | 29 | | } |