Parsing this String from YML.

Discussion in 'Plugin Development' started by iPhysX, Dec 15, 2011.

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

    iPhysX

    Code:
    ritual-hunter:
        1:DIAMOND,1
        2:DIAMOND,1
        3:DIAMOND,1
    I know how to get the String from the file.
    I just need to know how to find the item and the number seperately?

    Thanks!
     
  2. Offline

    jinqs

    Once you have the string from the file, you can split it yourself.

    String[] parts = string.split(","); // splits the String into multiple strings around the "," character
    String item = parts[0]; // stores the first half in a variable
    int number = Integer.parseInt(parts[1]); // converts the second half to an int and puts it in a variable
     
  3. Offline

    iPhysX

    Thanks alot @jinqs
    I have decided to do it differently before I read this, but I will use this in the future:)

    EDIT: used this. THANKS!
     
Thread Status:
Not open for further replies.

Share This Page