0

Let's say I have a string like function arg1 arg2 "arg3 is long".

How could I obtain the output of

String[0] = "function"
String[1] = "arg1"
String[2] = "arg2"
String[3] = "arg is long"
ixchi
  • 2,349
  • 2
  • 26
  • 23
  • 2
    What would you want the output to be from that example? – daniel gratzer Dec 28 '12 at 23:28
  • A String[] with the contents of String[0] = "function"; String[1] = "arg1"; etc – ixchi Dec 28 '12 at 23:30
  • 2
    possible duplicate of [Regex for splitting a string using space when not surrounded by single or double quotes](http://stackoverflow.com/questions/366202/regex-for-splitting-a-string-using-space-when-not-surrounded-by-single-or-double) – Jeff Storey Dec 28 '12 at 23:30
  • 1
    Your question is very confusing. Restate it in brief and to the point. – Smit Dec 28 '12 at 23:31

1 Answers1

1

This question's answer has a number of options for you to explore, but they are tailored for real command-line arguments.

Community
  • 1
  • 1
Fls'Zen
  • 4,594
  • 1
  • 29
  • 37