On 02/04/2008, Daniel Tripp <[EMAIL PROTECTED]> wrote:
> Let X represent what I'm looking for.
>
>  X differs from split() in that X will handle quotes, spaces, and slashes in
>  a sensible, command-lineish way, whereas split() does not.
>

Which OS(es) are you targetting?
Different OSes handle quotes and slashes in quite different ways.

CLI expects to be passed the argument list from the OS, and it is Java
that splits up the initial command-line after it has been processed by
the OS.

So are you looking to emulate that?
In which case, perhaps the Harmony project has some code that will do
what you want.

There's another set of problems to be solved if you want to generate
command-lines for Runtime.exec(), because you may need to protect
against variable interpolation by the OS.

>  If, as it seems, X doesn't exist in CLI, then it's not a matter of X
>  differing from CLI so much as X complementing CLI and, I think, possibly
>  being a useful addition to CLI.  The output of X would naturally become the
>  input to CommandLineParser.parse()'s 'arguments' parameter, in a typical
>  usage scenario.
>
>
>
>
>  -----Original Message-----
>  From: sebb [mailto:[EMAIL PROTECTED]
>  Sent: April 2, 2008 4:56 PM
>  To: Jakarta Commons Users List; [EMAIL PROTECTED]
>  Subject: Re: [cli] method to convert a string (which is a whole command
>  line) into an array (of arguments)
>
>  What exactly are you looking for that is different from split() and CLI?
>
>
>  On 02/04/2008, Daniel Tripp <[EMAIL PROTECTED]> wrote:
>  > Indeed, Eclipse's way takes about 100 lines of code, and it has an
>  > option to  treat quotes windows-style or not (which I don't claim to
>  > understand.)
>  >
>  >
>  >
>  >  -----Original Message-----
>  >  From: [EMAIL PROTECTED]
>  > [mailto:[EMAIL PROTECTED] On  Behalf Of James Carman
>  >  Sent: April 2, 2008 3:04 PM
>  >  To: Jakarta Commons Users List
>  >  Subject: Re: [cli] method to convert a string (which is a whole
>  > command
>  >  line) into an array (of arguments)
>  >
>  >  That won't account for arguments that are surrounded by quotes.
>  >
>  >  On Wed, Apr 2, 2008 at 4:02 PM,  <[EMAIL PROTECTED]> wrote:
>  >  > On Wed, Apr 2, 2008 at 3:58 PM, Daniel Tripp
>  > <[EMAIL PROTECTED]>
>  >  wrote:
>  >  >  > Hello.  I've been looking for a method to parse a command-line
>  > > string into  >  an string-array  >  >  System.out.println("hello
>  > world".split("\\s+"));  >  >  -jesse  >  >  >  >
>  > ---------------------------------------------------------------------
>  >  >  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  >  >  For additional commands, e-mail: [EMAIL PROTECTED]  >
>  > >
>  >
>  >  ---------------------------------------------------------------------
>  >  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  >  For additional commands, e-mail: [EMAIL PROTECTED]
>  >
>  >
>  >  ---------------------------------------------------------------------
>  >  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  >  For additional commands, e-mail: [EMAIL PROTECTED]
>  >
>  >
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to