From 20d35a640570eab1a47e4bd8c156f1e8aeb7db2d Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 1 Jun 2014 00:11:04 -0400 Subject: isolate .net specific methods in model project --- MediaBrowser.Model/Extensions/StringHelper.cs | 60 +++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create 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 new file mode 100644 index 000000000..b3ebc3f22 --- /dev/null +++ b/MediaBrowser.Model/Extensions/StringHelper.cs @@ -0,0 +1,60 @@ +using System; +using System.Globalization; + +namespace MediaBrowser.Model.Extensions +{ + 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); + } + } +} -- cgit v1.2.3