| | | 1 | | // ----------------------------------------------------------------------- |
| | | 2 | | // <copyright file="KebabCasingTransform.cs" company="Stéphane ANDRE"> |
| | | 3 | | // Copyright (c) Stéphane ANDRE. All rights reserved. |
| | | 4 | | // </copyright> |
| | | 5 | | // ----------------------------------------------------------------------- |
| | | 6 | | |
| | | 7 | | using System; |
| | | 8 | | using System.Globalization; |
| | | 9 | | |
| | | 10 | | namespace MyNet.Text.TextCasing; |
| | | 11 | | |
| | | 12 | | /// <summary> |
| | | 13 | | /// Transforms a string to kebab-case. |
| | | 14 | | /// </summary> |
| | | 15 | | public sealed class KebabCasingTransform : ITextCasingTransform |
| | | 16 | | { |
| | | 17 | | /// <summary> |
| | | 18 | | /// Initializes a new instance of the <see cref="KebabCasingTransform"/> class. |
| | | 19 | | /// </summary> |
| | 6 | 20 | | internal KebabCasingTransform() { } |
| | | 21 | | |
| | | 22 | | /// <inheritdoc/> |
| | | 23 | | public string Apply(string input, CultureInfo culture) |
| | | 24 | | { |
| | 30 | 25 | | ArgumentNullException.ThrowIfNull(input); |
| | 30 | 26 | | ArgumentNullException.ThrowIfNull(culture); |
| | | 27 | | |
| | 30 | 28 | | var snake = new SnakeCasingTransform().Apply(input, culture); |
| | 30 | 29 | | return snake.Replace('_', '-'); |
| | | 30 | | } |
| | | 31 | | } |
| | | 32 | | |