TechArena Community

TechArena Community (
-   Software Development (
-   -   stringtokenizer in batch file / dos command (

sayeed 14-10-2009 01:19 PM

stringtokenizer in batch file / dos command
Can anyone teach me how to perform or do a stringtokenizer in DOS Command or Batch File. What I want is a trick to split some sort of strings and then I want to iterate those each strings using the loop method. Thanks for any help.

JAMES_911 14-10-2009 01:22 PM

Re: stringtokenizer in batch file / dos command
Basically, the string tokenizer class allows an application to break a string into tokens. The tokenization method is much simpler than the one used by the StreamTokenizer class. The StringTokenizer methods do not distinguish among identifiers, numbers, and quoted strings, nor do they recognize and skip comments.

Expertz 14-10-2009 01:26 PM

Re: stringtokenizer in batch file / dos command
StringTokenizer in Java, here you go:

String cadenaPreguntas = request.getParameter(Keys.PREGUNTA_CADENA);
                //System.out.println("cadena de Preguntas" + cadenaPreguntas);
                StringTokenizer tokenizerPreguntas = new StringTokenizer(cadenaPreguntas, "||");
                String stringPregunta = "";
                while (tokenizerPreguntas.hasMoreTokens()) {
                    stringPregunta = tokenizerPreguntas.nextToken();
                    Pregunta pregunta = new Pregunta();
                    StringTokenizer tokenizerAtributosPregunta = new StringTokenizer( stringPregunta, "##");
                    // primero el texto de la pregunta
                    String textoPreg = tokenizerAtributosPregunta.nextToken();
                    if (!textoPreg.equals("")) {
                            pregunta.setTextoPregunta( Utilities.esNulo(textoPreg) );

All times are GMT +5.5. The time now is 06:33 AM.