diff --git a/src/BizHawk.Common/Extensions/StringExtensions.cs b/src/BizHawk.Common/Extensions/StringExtensions.cs index 5ccebffa09..ca4c0ecce3 100644 --- a/src/BizHawk.Common/Extensions/StringExtensions.cs +++ b/src/BizHawk.Common/Extensions/StringExtensions.cs @@ -5,7 +5,29 @@ namespace BizHawk.Common.StringExtensions { public static class StringExtensions { - /// if appears in (case-insensitive) - public static bool In(this string str, params string[] options) => options.Any(opt => string.Equals(opt, str, StringComparison.InvariantCultureIgnoreCase)); + /// + /// if appears in (case-insensitive) + /// + public static bool In(this string str, params string[] options) => + options.Any(opt => string.Equals(opt, str, StringComparison.InvariantCultureIgnoreCase)); + + /// + /// with the last char removed, or the original + /// if the last char of is not + /// + public static string RemoveSuffix(this string str, char suffix) => + str.Length != 0 && str[str.Length - 1] == suffix + ? str.Substring(0, str.Length - 1) + : str; + + /// + /// the substring of before the first occurrence of + /// , or if not found + /// + public static string? SubstringBeforeOrNull(this string str, string delimiter) + { + var index = str.IndexOf(delimiter); + return index < 0 ? null : str.Substring(0, index); + } } } diff --git a/src/BizHawk.Common/Extensions/SubstringExtensions.cs b/src/BizHawk.Common/Extensions/SubstringExtensions.cs deleted file mode 100644 index 5077c0fa77..0000000000 --- a/src/BizHawk.Common/Extensions/SubstringExtensions.cs +++ /dev/null @@ -1,34 +0,0 @@ -namespace BizHawk.Common.StringExtensions -{ - public static class SubstringExtensions - { - /// - /// with the last char removed, or the original - /// if the last char of is not - /// - public static string RemoveSuffix(this string str, char suffix) => - str.Length != 0 && str[str.Length - 1] == suffix - ? str.Substring(0, str.Length - 1) - : str; - - /// - /// the substring of before the first occurrence of - /// , or the original if not found - /// - public static string SubstringBefore(this string str, char delimiter) - { - var index = str.IndexOf(delimiter); - return index < 0 ? str : str.Substring(0, index); - } - - /// - /// the substring of before the first occurrence of - /// , or if not found - /// - public static string? SubstringBeforeOrNull(this string str, string delimiter) - { - var index = str.IndexOf(delimiter); - return index < 0 ? null : str.Substring(0, index); - } - } -}