Results 1 to 3 of 3

Thread: stringtokenizer in batch file / dos command

  1. #1
    Join Date
    Oct 2005
    Posts
    81

    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.

  2. #2
    Join Date
    Dec 2007
    Posts
    1,736

    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.

  3. #3
    Join Date
    Dec 2007
    Posts
    1,599

    Re: stringtokenizer in batch file / dos command

    StringTokenizer in Java, here you go:
    Code:
    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) );
    		    }

Similar Threads

  1. How to work with if command and batch file
    By kolton in forum Operating Systems
    Replies: 5
    Last Post: 01-12-2010, 12:09 AM
  2. Batch halts on last command
    By Indrani in forum Operating Systems
    Replies: 2
    Last Post: 25-07-2009, 09:29 PM
  3. How Sleep command work on Batch file in Windows
    By afidelino in forum Technology & Internet
    Replies: 3
    Last Post: 08-07-2009, 10:42 AM
  4. Can We check the exit command in the batch file
    By Dhruv in forum Software Development
    Replies: 3
    Last Post: 30-12-2008, 11:56 PM
  5. Replies: 1
    Last Post: 18-03-2007, 12:22 AM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Page generated in 1,714,253,719.90060 seconds with 17 queries