Skip to content

Commit

Permalink
Move string extension
Browse files Browse the repository at this point in the history
  • Loading branch information
lyarenei committed Sep 28, 2024
1 parent b0df018 commit 0372c66
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,16 @@ public static string Capitalize(this string s)
if (string.IsNullOrEmpty(s)) return s;
return char.ToUpper(s[0], CultureInfo.InvariantCulture) + s[1..];
}

/// <summary>
/// Converts string to kebab-case.
/// </summary>
/// <param name="str">String to convert.</param>
/// <returns>Converted string.</returns>
/// Inspired by: https://stackoverflow.com/a/58576400.
public static string ToKebabCase(this string str)
{
var newStr = string.Concat(str.Select((c, i) => i > 0 && char.IsUpper(c) ? "-" + c : c.ToString()));
return newStr.ToLower(CultureInfo.InvariantCulture);
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
using System.Text.Json;
using Jellyfin.Plugin.ListenBrainz.MusicBrainzApi.Extensions;
using Jellyfin.Plugin.ListenBrainz.Common.Extensions;

namespace Jellyfin.Plugin.ListenBrainz.MusicBrainzApi.Json;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using Jellyfin.Plugin.ListenBrainz.MusicBrainzApi.Extensions;
using Jellyfin.Plugin.ListenBrainz.Common.Extensions;
using Xunit;

namespace Jellyfin.Plugin.ListenBrainz.MusicBrainzApi.Tests;
Expand Down

0 comments on commit 0372c66

Please sign in to comment.