From 48facb797ed912e4ea6b04b17d1ff190ac2daac4 Mon Sep 17 00:00:00 2001 From: stefan Date: Wed, 12 Sep 2018 19:26:21 +0200 Subject: Update to 3.5.2 and .net core 2.1 --- MediaBrowser.Model/Extensions/StringHelper.cs | 134 -------------------------- 1 file changed, 134 deletions(-) delete mode 100644 MediaBrowser.Model/Extensions/StringHelper.cs (limited to 'MediaBrowser.Model/Extensions/StringHelper.cs') diff --git a/MediaBrowser.Model/Extensions/StringHelper.cs b/MediaBrowser.Model/Extensions/StringHelper.cs deleted file mode 100644 index 9cde3bfa4..000000000 --- a/MediaBrowser.Model/Extensions/StringHelper.cs +++ /dev/null @@ -1,134 +0,0 @@ -using System; -using System.Globalization; -using System.Text; -using System.Text.RegularExpressions; - -namespace MediaBrowser.Model.Extensions -{ - /// - /// Isolating these helpers allow this entire project to be easily converted to Java - /// - public static class StringHelper - { - /// - /// Equalses the ignore case. - /// - /// The STR1. - /// The STR2. - /// true if XXXX, false otherwise. - public static bool EqualsIgnoreCase(string str1, string str2) - { - return string.Equals(str1, str2, StringComparison.OrdinalIgnoreCase); - } - - /// - /// Indexes the of ignore case. - /// - /// The string. - /// The value. - /// System.Int32. - public static int IndexOfIgnoreCase(string str, string value) - { - return str.IndexOf(value, StringComparison.OrdinalIgnoreCase); - } - - /// - /// To the string culture invariant. - /// - /// The value. - /// System.String. - public static string ToStringCultureInvariant(int val) - { - return val.ToString(CultureInfo.InvariantCulture); - } - - /// - /// To the string culture invariant. - /// - /// The value. - /// System.String. - public static string ToStringCultureInvariant(long val) - { - return val.ToString(CultureInfo.InvariantCulture); - } - - /// - /// To the string culture invariant. - /// - /// The value. - /// System.String. - public static string ToStringCultureInvariant(double val) - { - return val.ToString(CultureInfo.InvariantCulture); - } - - /// - /// Trims the start. - /// - /// The string. - /// The c. - /// System.String. - public static string TrimStart(string str, char c) - { - return str.TrimStart(c); - } - - /// - /// Splits the specified string. - /// - /// The string. - /// The term. - /// System.String[]. - public static string[] RegexSplit(string str, string term) - { - return Regex.Split(str, term, RegexOptions.IgnoreCase); - } - - /// - /// Splits the specified string. - /// - /// The string. - /// The term. - /// The limit. - /// System.String[]. - public static string[] RegexSplit(string str, string term, int limit) - { - return new Regex(term).Split(str, limit); - } - - /// - /// Replaces the specified STR. - /// - /// The STR. - /// The old value. - /// The new value. - /// The comparison. - /// System.String. - public static string Replace(this string str, string oldValue, string newValue, StringComparison comparison) - { - var sb = new StringBuilder(); - - var previousIndex = 0; - var index = str.IndexOf(oldValue, comparison); - - while (index != -1) - { - sb.Append(str.Substring(previousIndex, index - previousIndex)); - sb.Append(newValue); - index += oldValue.Length; - - previousIndex = index; - index = str.IndexOf(oldValue, index, comparison); - } - - sb.Append(str.Substring(previousIndex)); - - return sb.ToString(); - } - - public static string FirstToUpper(this string str) - { - return string.IsNullOrEmpty(str) ? "" : str.Substring(0, 1).ToUpper() + str.Substring(1); - } - } -} -- cgit v1.2.3