Replace string par string
Bonjour,
Voila, je voudrais remplacer dans une chaine, un morceau de chaine par un autre.
Dans la javadoc, j'ai trouvé la méthode qui convient parfaitement :
Citation:
replaceAll(String regex, String replacement)
Replaces each substring of this string that matches the given regular expression with the given replacement.
Mais apparement ca ne fait rien, je pensais qu'il suffisait de définir un groupe pr l'expression réguliere.
voila mon code :
Code:
1 2 3
|
String test = "/path1/path/toto";
test.replaceAll("(/path1/path)", "http://www.domain.com/path1/path"); |
Et ca ne remplace rien :)
Merci d'avance ;)