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.
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.
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.
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) ); }
Bookmarks