String s = "arg1?arg2?arg3";
StringTokenizer tok = new StringTokenizer(s, "?");
ArrayList a = new ArrayList();
while ( tok.hasMoreElements()){
a.add(tok.nextElement());
}
String t;
for (int i = 0; i < a.size() ; i++){
t += a.get(i);
}
System.out.println(t);
sven
cezinha tng wrote:
> Dúvidas sobre o String Tokenizer:
>
> Pessoal, gostaria de saber como eu uso o
> StringTokenizer para separar uma string, em vários
> argumentos.
>
> Exemplo:
>
> Eu tenho uma string do tipo
> "argumento1:argumento2:argumento3"
>
> Como é que eu utilizo o StringTokenizer para separar
> essa string em argumento1, argumento2 e argumento3 ?
>
>
> Exemplo:
> String string=" argumento1?argumento2?argumento3";
>
> x1=argumento1;
> x2=argumento2;
> x3=argumento3;
>
> System.out.println(x1+x2+x3);
>
>
> Agradeço antecipadamente!
>
>
> Valeu pessoal!
>
>
>
> __________________________________________________
> Do You Yahoo!?
> Yahoo! Auctions - buy the things you want at great prices
> http://auctions.yahoo.com/
>
> ------------------------------ LISTA SOUJAVA ----------------------------
> http://www.soujava.org.br - Sociedade de Usuários Java da Sucesu-SP
> dúvidas mais comuns: http://www.soujava.org.br/faq.htm
> regras da lista: http://www.soujava.org.br/regras.htm
> para sair da lista: envie email para [EMAIL PROTECTED]
> -------------------------------------------------------------------------
>
>
------------------------------ LISTA SOUJAVA ----------------------------
http://www.soujava.org.br - Sociedade de Usuários Java da Sucesu-SP
dúvidas mais comuns: http://www.soujava.org.br/faq.htm
regras da lista: http://www.soujava.org.br/regras.htm
para sair da lista: envie email para [EMAIL PROTECTED]
-------------------------------------------------------------------------