What is the recommended way to parse command line in Java. At the same time, I do not mean processing options when they are already in the form of an array (for example, processing "-x", etc.). There are already many questions and answers.
No, I mean splitting the full command line into "tokens." I need to convert a string, for example:
user 123712378 suspend "They are \"bad guys\"" Or\ are\ they?
... to list / array:
user 123712378 suspend They are "bad guys" Or are they?
I am currently just doing a space division, but this obviously cannot handle quotes and escaped spaces.
(quote processing is most important. Hidden spaces would be nice)
Note. My command line is the input from a shell-like web interface. It is not built from main(String[] args)
source share