Utiliser un \ et split en java

Résolu
sanaaafkir Messages postés 17 Date d'inscription vendredi 17 novembre 2000 Statut Membre Dernière intervention 13 mars 2008 - 7 mars 2006 à 11:52
cs_amalita Messages postés 5 Date d'inscription jeudi 8 mars 2012 Statut Membre Dernière intervention 19 mai 2012 - 5 mai 2012 à 13:50
bonjour;
comment peux utiliser l'antislash "" avec une methode Split en java
et merci en avance.

3 réponses

Twinuts Messages postés 5375 Date d'inscription dimanche 4 mai 2003 Statut Modérateur Dernière intervention 14 juin 2023 111
7 mars 2006 à 12:35
Salut,



tu peux les echaper.



l'extrait ci dessous est pris sur ce lien :

http://www.regular-expressions.info/java.html



The same backslash-mess occurs when providing replacement strings for
methods like String.replaceAll() as literal Java strings in your Java
code. In the replacement text, a dollar sign must be encoded as \$ and
a backslash as \\ when you want to replace the regex match with an
actual dollar sign or backslash. However, backslashes must also be
escaped in literal Java strings. So a single dollar sign in the
replacement text becomes <tt>"\\$"</tt> when written as a literal Java string. The single backslash becomes <tt>"\\\"</tt>. Right again: 4 backslashes to insert a single one.


WORA
3
sanaaafkir Messages postés 17 Date d'inscription vendredi 17 novembre 2000 Statut Membre Dernière intervention 13 mars 2008
7 mars 2006 à 13:26
merci pour ton aide Twinuts ça marche
0
cs_amalita Messages postés 5 Date d'inscription jeudi 8 mars 2012 Statut Membre Dernière intervention 19 mai 2012
5 mai 2012 à 13:50
bojour;
comment peux on utiliser le virgule "," avec une methode Split en java
et merci en avance.
0
Rejoignez-nous