Browse Source

[eval] fix String.split again

Simon Krajewski 7 years ago
parent
commit
c8df8719da
2 changed files with 3 additions and 1 deletions
  1. 1 1
      src/macro/eval/evalStdLib.ml
  2. 2 0
      tests/unit/src/unitstd/Unicode.unit.hx

+ 1 - 1
src/macro/eval/evalStdLib.ml

@@ -2023,7 +2023,7 @@ module StdString = struct
 					if i = l_this then raise Not_found;
 					let index = String.index_from s i chr in
 					DynArray.add acc (encode_range i (index - i));
-					loop1 (index + l_delimiter)
+					loop1 (index + (l_delimiter lsl (if ascii then 0 else 1)))
 				with Not_found ->
 					DynArray.add acc (encode_range i (l_this - i))
 			in

+ 2 - 0
tests/unit/src/unitstd/Unicode.unit.hx

@@ -221,4 +221,6 @@ var s = buf.toString();
 s == "Hello World!";
 s.length == 12;
 
+"äabc:def".substr(1).split(":") == ["abc","def"];
+
 #end