namespace CommonCore.Base.Extensions; public static class StringExtensions { public static bool EqualsIgnoreCase(this string str, string otherString) => str.Equals(otherString, StringComparison.OrdinalIgnoreCase); public static bool ContainsIgnoreCase(this string str, string otherString) => str.IndexOf(otherString, StringComparison.OrdinalIgnoreCase) != -1; /// /// Truncate a string to exactly characters. /// /// /// The maximum number of characters. If has fewer characters, it will be truncated to the length of . public static string Truncate(this string str, int maxLength) => str[..Math.Min(str.Length, maxLength)]; }