diff --git a/CustomizePlus/Core/Extensions/StringExtensions.cs b/CustomizePlus/Core/Extensions/StringExtensions.cs index 312e980..aefb33b 100644 --- a/CustomizePlus/Core/Extensions/StringExtensions.cs +++ b/CustomizePlus/Core/Extensions/StringExtensions.cs @@ -1,4 +1,5 @@ using Dalamud.Utility; +using System; namespace CustomizePlus.Core.Extensions; @@ -15,17 +16,22 @@ internal static class StringExtensions #if !INCOGNIFY_STRINGS return str; #endif - if (str.Contains(" ")) { var split = str.Split(' '); - if (split.Length > 2) - return $"{str[..5]}..."; - - return $"{split[0][0]}.{split[1][0]}"; + if (split.Length == 2) + return $"{split[0][0]}.{split[1][0]}"; } - return $"{str[..5]}..."; + return str.GetCutString(); + } + + private static string GetCutString(this string str, int maxLength = 5) + { + if(str.Length > maxLength) + return $"{str[..maxLength]}..."; + else + return str[0..Math.Min(str.Length, maxLength)]; } } diff --git a/CustomizePlus/CustomizePlus.csproj b/CustomizePlus/CustomizePlus.csproj index 255756c..bf35d6f 100644 --- a/CustomizePlus/CustomizePlus.csproj +++ b/CustomizePlus/CustomizePlus.csproj @@ -4,7 +4,7 @@ - 2.0.0.1 + 2.0.0.2 Customize+ https://github.com/Aether-Tools/CustomizePlus