pb avec replaceFirst

pb avec replaceFirst - Java - Programmation

Marsh Posté le 16-02-2004 à 13:37:25    

Bonjour,
j'utilise replaceFirst :
 
    command = "test de remplacement";
    commandMod = command.replaceFirst("de", "toto\\titi" );
 
et je perds les \ dans le remplacement :
 
    test tototiti remplacement
 
des idées ?


---------------
"Les conneries, c'est comme les impôts, on finit toujours par les payer." Michel Audiard
Reply

Marsh Posté le 16-02-2004 à 13:37:25   

Reply

Marsh Posté le 16-02-2004 à 13:39:37    

Citation :


public String replaceFirst(String regex,
                           String replacement)
 
    Replaces the first substring of this string that matches the given regular expression with the given replacement.


T'as maté ce qu'était une "regular expression" avant d'essayer d'utiliser la fonction ? :whistle:


---------------
Everyone thinks of changing the world, but no one thinks of changing himself  |  It is the peculiar quality of a fool to perceive the faults of others and to forget his own  |  Early clumsiness is not a verdict, it’s an essential ingredient.
Reply

Sujets relatifs:

Leave a Replay

Make sure you enter the(*)required information where indicate.HTML code is not allowed