-
Notifications
You must be signed in to change notification settings - Fork 153
Open
Description
Describe the bug
"abc".split("") get error array ["","a","b","c"]
To Reproduce
use j2clmavenplugin
//in java MathUtil.java
package cn.util;
import jsinterop.annotations.JsType;
@JsType
public class MathUtil {
public static native void ppp(String s);
public static void test() {
String s = "abc";
ppp(s);
String[] split = s.split("");
ppp("String.valueOf(split)"+"["+String.valueOf(split)+"]");
ppp("split.length "+split.length+"");
for (String s1 : split) {
ppp("["+s1+"]");
}
}
}//MathUtil.native.js
setTimeout(function() {
MathUtil.ppp = function (s) {
console.log(s);
}
MathUtil.test();
}, 0);get result in browser console
abc
String.valueOf(split)[,a,b,c]
split.length 4
[]
[a]
[b]
[c]
"abc".split("") The expected result is ["a","b","c"]
treblereel
Metadata
Metadata
Assignees
Labels
No labels