Skip to content

Commit

Permalink
[cs] More Ordinal comparisons
Browse files Browse the repository at this point in the history
  • Loading branch information
waneck committed Aug 5, 2014
1 parent 1cd97a3 commit 5223f9b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 33 deletions.
29 changes: 0 additions & 29 deletions std/cs/internal/Runtime.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
8 changes: 4 additions & 4 deletions std/cs/internal/StringExt.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -182,15 +182,15 @@ private typedef NativeString = String;
}

@:functionCode('
return me.ToLower();
return me.ToLowerInvariant();
')
public static function toLowerCase(me:NativeString):NativeString
{
return null;
}

@:functionCode('
return me.ToUpper();
return me.ToUpperInvariant();
')
public static function toUpperCase(me:NativeString):NativeString
{
Expand Down

0 comments on commit 5223f9b

Please sign in to comment.