Browse Source

[cs] More Ordinal comparisons

Cauê Waneck 11 years ago
parent
commit
5223f9b916
2 changed files with 4 additions and 33 deletions
  1. 0 29
      std/cs/internal/Runtime.hx
  2. 4 4
      std/cs/internal/StringExt.hx

+ 0 - 29
std/cs/internal/Runtime.hx

@@ -255,35 +255,6 @@ import cs.system.Object;
 							l1 = s1.length,
 							l2 = s2.length;
 					return String.Compare(s1,s2, cs.system.StringComparison.Ordinal);
-					// bool active = true;
-					// while(active)
-					// {
-					// 	char h1; char h2;
-					// 	if (i >= l1)
-					// 	{
-					// 		h1 = (char) 0;
-					// 		active = false;
-					// 	} else {
-					// 		h1 = s1[i];
-					// 	}
-
-					// 	if (i >= l2)
-					// 	{
-					// 		h2 = (char) 0;
-					// 		active = false;
-					// 	} else {
-					// 		h2 = s2[i];
-					// 	}
-
-					// 	int v = h1 - h2;
-					// 	if (v > 0)
-					// 		return 1;
-					// 	else if (v < 0)
-					// 		return -1;
-
-					// 	i++;
-					// }
-					// return 0;
 				case cs.system.TypeCode.Double:
 					var d1:Float = cast v1,
 							d2:Float = cv2.ToDouble(null);

+ 4 - 4
std/cs/internal/StringExt.hx

@@ -52,7 +52,7 @@ private typedef NativeString = String;
 			uint sIndex = (startIndex.hasValue) ? ((uint) startIndex.@value) : 0;
 			if (sIndex >= me.Length)
 				return -1;
-			return me.IndexOf(str, (int)sIndex);
+			return me.IndexOf(str, (int)sIndex, System.StringComparison.Ordinal);
 	')
 	public static function indexOf(me:NativeString, str:NativeString, ?startIndex:Int):Int
 	{
@@ -87,7 +87,7 @@ private typedef NativeString = String;
 
 				return -1;
 			} else {
-				return me.LastIndexOf(str, sIndex);
+				return me.LastIndexOf(str, sIndex, System.StringComparison.Ordinal);
 			}
 	')
 	public static function lastIndexOf(me:NativeString, str:NativeString, ?startIndex:Int):Int
@@ -182,7 +182,7 @@ private typedef NativeString = String;
 	}
 
 	@:functionCode('
-			return me.ToLower();
+			return me.ToLowerInvariant();
 	')
 	public static function toLowerCase(me:NativeString):NativeString
 	{
@@ -190,7 +190,7 @@ private typedef NativeString = String;
 	}
 
 	@:functionCode('
-			return me.ToUpper();
+			return me.ToUpperInvariant();
 	')
 	public static function toUpperCase(me:NativeString):NativeString
 	{