javascript - Split java strings in Rhino -


I am trying to divide a Java string into the Rhino JavaScript program

  Var s = new java.lang.String ("1 2 3"); S.split ();  

who gives me an error

 js: can not find the method java.lang.String.split () 

Rhino docs All javascript strings are mentioned. Prototype method (such as matches, splits, etc.) are available on Java string if they have not already been provided by java.lang.String. Any idea what's going on here?

Take a look at the Java docs:

A 0 parameter for the partitioned method Constructor does not appear. You have to give it a regular expression.

Also, for more explanation, the partitioning method gives a string array, the way you used it in your sample code is not a zero method.


Comments