bob82fr
Messages postés38Date d'inscriptionsamedi 1 février 2003StatutMembreDernière intervention13 janvier 2005
-
10 juin 2003 à 18:41
cs_Melchia
Messages postés1Date d'inscriptionmardi 22 avril 2003StatutMembreDernière intervention28 avril 2004
-
28 avril 2004 à 12:36
lut!
comment convertir un char en String, et inversement?
cs_Duss
Messages postés890Date d'inscriptionlundi 8 avril 2002StatutMembreDernière intervention29 juillet 200411 11 juin 2003 à 09:05
salut,
tu as une methode toCharArray() dans String qui te retourne un tableau de char
sinon tu peux aussi faire un String.valueOf(mavariablechar);
pour transformer un char en String
Duss
cs_Melchia
Messages postés1Date d'inscriptionmardi 22 avril 2003StatutMembreDernière intervention28 avril 2004 28 avril 2004 à 12:36
Exemple d'utilisation de ToCharArray :
class toCharArray_Example {
public static void main(String[] args) {
String strChaine = new String("Chaîne d'essai");
char[] c = strChaine.toCharArray();
for(int i = 0; i <= c.length; i++)
System.out.println(c[i]);
}
}