diff --git a/BizHawk.Common/Extensions/StringExtensions.cs b/BizHawk.Common/Extensions/StringExtensions.cs index 3deba6cc8e..c23a40580e 100644 --- a/BizHawk.Common/Extensions/StringExtensions.cs +++ b/BizHawk.Common/Extensions/StringExtensions.cs @@ -22,24 +22,6 @@ namespace BizHawk.Common.StringExtensions /// how many times appears in , or 0 if is null public static int HowMany(this string? str, char c) => string.IsNullOrEmpty(str) ? 0 : str.Count(t => t == c); - /// how many times appears in , or 0 if is null - /// - /// occurrences may overlap, for example "AAA".HowMany("AA") returns 2
- /// TODO except it doesn't, but "AAAB".HowMany("AA") does. I left this bug in so as to not break anything. --yoshi - ///
- public static int HowMany(this string? str, string sub) - { - if (string.IsNullOrEmpty(str)) return 0; - - var count = 0; - var substrLength = sub.Length; - for (int i = 0, l = str.Length - substrLength; i < l; i++) - { - if (string.Equals(str.Substring(i, substrLength), sub, StringComparison.InvariantCulture)) count++; - } - return count; - } - /// iff is not and all chars of are digits public static bool IsUnsigned(this string? str) => !string.IsNullOrWhiteSpace(str) && str.All(IsUnsigned);