utiliza o StringTokenizer
String s = "este e a minha pergunta";
StringTokenizer t = new StringTokenizer(s, " ");
s = "";
while(t.hasMoreElements()){
   String token = t.nextElement();
   if (token.equals("minha")) token = "sua";
   if (token.equals("pergunta")) token = "resposta";
   s += token + " ";
}
System.out.println(s);


Sérgio Larentis Junior wrote:
017b01c0e886$5ee96670$1300a8c0@xfiles">
Foi isso q eu tb descobri, a minha duvida é... Como fazer ?? :-((
----- Original Message -----
Sent: Tuesday, May 29, 2001 9:46 AM
Subject: Re: [java-list] Replace

Sérgio,

     O replace espera somente a entrada de "char", ou seja, 1 caracter e te retorna uma string.

    Segue um exemplo que achei na documentação do Java.

               "mesquite in your cellar".replace('e', 'o')
                     returns "mosquito in your collar"
                "the war of baronets".replace('r', 'y')
                    returns "the way of bayonets"
                "sparring with a purple porpoise".replace('p', 't')
                   returns "starring with a turtle tortoise"
                 "JonL".replace('q', 'x') returns "JonL" (no change)
 

  Sérgio_Larentis_Junior <[EMAIL PROTECTED]> wrote:

Como faco um replace  tipo
 
   variavelstring.replace ("BLABLABLA","UHUHUHUHU");
????
  infelizmente esse comando nao funciona, ja exprimentei usar aspas simples e tudo mais, alguem pode me ajudar????
 



Do You Yahoo!?
Yahoo! Auctions $2 Million Sweepstakes - Got something to sell?

Responder a