CommandLineTokenizer (JSAP: the Java Simple Argument Parser)
Keywords: com.martiansoftware.jsap.CommandLineTokenizer class

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.martiansoftware.jsap
Class CommandLineTokenizer

    java.lang.Object
      com.martiansoftware.jsap.CommandLineTokenizer

    public class CommandLineTokenizer

extends Object

A utility class to parse a command line contained in a single String into an array of argument tokens, much as the JVM (or more accurately, your operating system) does before calling your programs' `public static void main(String[] args)` methods.

This class has been developed to parse the command line in the same way that MS Windows 2000 does. Arguments containing spaces should be enclosed in quotes. Quotes that should be in the argument string should be escaped with a preceding backslash ('\') character. Backslash characters that should be in the argument string should also be escaped with a preceding backslash character.

Whenever `JSAP.parse(String)` is called, the specified String is tokenized by this class, then forwarded to `JSAP.parse(String[])` for further processing.

Author:
  Marty Lamb
See Also:
  `JSAP.parse(String)`, `JSAP.parse(String[])`

Method Summary
`static String[]` | `tokenize(String commandLine)` Parses the specified command line into an array of individual arguments.

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### tokenize

    public static String[] tokenize(String commandLine)

  Parses the specified command line into an array of individual arguments. Arguments containing spaces should be enclosed in quotes. Quotes that should be in the argument string should be escaped with a preceding backslash ('\') character. Backslash characters that should be in the argument string should also be escaped with a preceding backslash character.

  Parameters:
    `commandLine` - the command line to parse
  Returns:
    an argument array representing the specified command line.

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2002-2005, Martian Software, Inc.. All Rights Reserved.
For the latest version and documentation, please visit http://www.martiansoftware.com/jsap