Solved Absolutely No Sense (String.split)

Discussion in 'Plugin Development' started by messageofdeath, Oct 14, 2013.

Thread Status:
Not open for further replies.
  1. Offline

    messageofdeath

    This is output from a program. (Pay attention to top two lines.)
    The top line is the input.
    The second line is what outputs with the System.out.println();
    [​IMG]


    This is the code.
    Code:java
    1. public static Cuboid getStringToCuboid(String cube) {
    2. System.out.println(cube.split("|")[0] + " | " + cube.split("|")[1]);
    3. return new Cuboid(Vector.getStringToVector(cube.split("|")[0]), Vector.getStringToVector(cube.split("|")[1]));
    4. }



    EDIT: Please note that [Spree] is not part of the input.
     
  2. Offline

    bbark9

    Your dealing with regexs. "|" is considered a special character. what you need to do is put "\\|" the "\\" makes it so regex is splitting | and not using it as a method.
     
Thread Status:
Not open for further replies.

Share This Page