fix logical error in substr
This commit is contained in:
@@ -753,6 +753,7 @@ class Prelude {
|
|||||||
}
|
}
|
||||||
#end
|
#end
|
||||||
|
|
||||||
|
// TODO this could get confusing, because its behavior (index to index) is the opposite of haxe substr.
|
||||||
public static function substr(str:String, startIdx:Int, ?endIdx:Int) {
|
public static function substr(str:String, startIdx:Int, ?endIdx:Int) {
|
||||||
function negIdx(idx) {
|
function negIdx(idx) {
|
||||||
return if (idx < 0) str.length + idx else idx;
|
return if (idx < 0) str.length + idx else idx;
|
||||||
@@ -760,7 +761,7 @@ class Prelude {
|
|||||||
|
|
||||||
if (endIdx == null) endIdx = str.length;
|
if (endIdx == null) endIdx = str.length;
|
||||||
|
|
||||||
return str.substr(negIdx(startIdx), negIdx(endIdx));
|
return str.substring(negIdx(startIdx), negIdx(endIdx));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static function runtimeInsertAssertionMessage(message:String, error:String, colonsInPrefix:Int) {
|
public static function runtimeInsertAssertionMessage(message:String, error:String, colonsInPrefix:Int) {
|
||||||
|
|||||||
Reference in New Issue
Block a user