Get String/int between two chars?

Discussion in 'Plugin Development' started by Spikes, Apr 18, 2013.

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



    I doing a config based pvp plugin. The Point is i wanna add Enchantments, amount and damage to a item stack. Currently i using the Split Method but I was asking myself if there is a more effect way.

    String items_raw = "373:16421#5|1-2.3-4|,261|1-2.3-4|,301:20|1-6|";
    String[] items = items_raw.split(",");
    I was looking kinda for this:
    String id = items.getUntil(":");
    String damage = items.getInBetween(":","#");
  2. Offline


    You could use Pattern to extract string between two chars. But maybe you should consider using StringTokenizer.
  3. Offline


    you can simply use items_raw.split(",|#\-") or something like that (See Regular Expressions)
Thread Status:
Not open for further replies.

Share This Page