This commit is contained in:
Nils Fürniß 2022-03-13 18:11:21 +01:00
parent 2d0cae5626
commit 69f6bca0df
No known key found for this signature in database
GPG Key ID: 79CB1318699409FF

View File

@ -22,21 +22,21 @@ namespace Jellyfin.Plugin.AniDB.Providers
/// Cut p(%) away from the string
/// </summary>
/// <param name="input"></param>
/// <param name="minLenght"></param>
/// <param name="minLength"></param>
/// <param name="p"></param>
/// <returns></returns>
public static string ShortenString(string input, int minLenght = 0, int p = 50)
public static string ShortenString(string input, int minLength = 0, int p = 50)
{
if (input.Length <= minLenght)
if (input.Length <= minLength)
{
return input;
}
int newLength = (int)((float)input.Length - (((float)input.Length / 100f) * (float)p));
if (newLength < minLenght)
if (newLength < minLength)
{
newLength = minLenght;
newLength = minLength;
}
return input.Substring(0, newLength);