Fixes code according to modern code style. Fixes a few expression bugs.

This commit is contained in:
Kamron Batman 2018-09-15 09:58:51 -07:00
parent 89eea25e5f
commit 970fd563b2
3324 changed files with 441118 additions and 433755 deletions

View file

@ -22,50 +22,50 @@ using System.Collections;
namespace Server
{
public static class Insensitive
{
public static IComparer Comparer { get; } = CaseInsensitiveComparer.Default;
public static class Insensitive
{
public static IComparer Comparer{ get; } = CaseInsensitiveComparer.Default;
public static int Compare( string a, string b )
{
return Comparer.Compare( a, b );
}
public static int Compare(string a, string b)
{
return Comparer.Compare(a, b);
}
public static bool Equals( string a, string b )
{
if ( a == null && b == null )
return true;
if ( a == null || b == null || a.Length != b.Length )
return false;
public static bool Equals(string a, string b)
{
if (a == null && b == null)
return true;
if (a == null || b == null || a.Length != b.Length)
return false;
return ( Comparer.Compare( a, b ) == 0 );
}
return Comparer.Compare(a, b) == 0;
}
public static bool StartsWith( string a, string b )
{
if ( a == null || b == null || a.Length < b.Length )
return false;
public static bool StartsWith(string a, string b)
{
if (a == null || b == null || a.Length < b.Length)
return false;
return ( Comparer.Compare( a.Substring( 0, b.Length ), b ) == 0 );
}
return Comparer.Compare(a.Substring(0, b.Length), b) == 0;
}
public static bool EndsWith( string a, string b )
{
if ( a == null || b == null || a.Length < b.Length )
return false;
public static bool EndsWith(string a, string b)
{
if (a == null || b == null || a.Length < b.Length)
return false;
return ( Comparer.Compare( a.Substring( a.Length - b.Length ), b ) == 0 );
}
return Comparer.Compare(a.Substring(a.Length - b.Length), b) == 0;
}
public static bool Contains( string a, string b )
{
if ( a == null || b == null || a.Length < b.Length )
return false;
public static bool Contains(string a, string b)
{
if (a == null || b == null || a.Length < b.Length)
return false;
a = a.ToLower();
b = b.ToLower();
a = a.ToLower();
b = b.ToLower();
return ( a.IndexOf( b ) >= 0 );
}
}
return a.IndexOf(b) >= 0;
}
}
}