Plugin Help Multiple words per argument

Discussion in 'Plugin Help/Development/Requests' started by Duuckky, Dec 19, 2014.

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

    Duuckky

    How would i make a multi-word argument indicated by using quotes ("") around the words they wish to use as the argument.

    Ex. ) /<command> "Hello There"

    where argument zero would be equal to "Hello There"

    - Thanks, Ducky
     
  2. Offline

    pie_flavor

    Cobble together a string from args, probably using a for loop. Then, continuallly run
    Code:java
    1. .replaceAll("\"(.*?) ","\"\1_")
    until the output is the same as the input. Notice the space after the second parenthesis, it's important.
    Code:java
    1. .replace("\"","");

    Code:java
    1. .split(" ");

    Then you should have your old args array back, but all the quote-surrounded sections have had the quotes removed and the spaces replaced with underscores. Then just parse them back when you're ready to use 'em.
     
Thread Status:
Not open for further replies.

Share This Page