Ascii & java - urgent svp

Fermé
guigui - 13 juin 2001 à 15:16
 guigui - 14 juin 2001 à 12:14
je voudrais savoir comment passer d'un code ascii (ou hexa) en String
par exemple, si j'ai 92 en ascii ou 5C en hexa, je voudrais obtenir "\"
merci
A voir également:

3 réponses

c'est plus la peine, j'ai trouvé
0
Jean-François Pillou Messages postés 18670 Date d'inscription lundi 15 février 1999 Statut Webmaster Dernière intervention 16 février 2023 63 279
14 juin 2001 à 12:00
Pourrais-tu donner la réponse STP? :-)
0
c'est tout con :

//tu mets ton code ascii dans un char
char myCode=92;
System.out.println(myCode); // tu as bien ton antislash

//et apres tu le transforme en string:
String myAntiSlash = new String();
myAntiSlash=myAntiSlash.valueOf(monChar);
System.out.println(myAntiSlash); // tu as toujours ton antislash

0