How do I split a String into chars and put those chars in a pre-declared Array? | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 2

How do I split a String into chars and put those chars in a pre-declared Array?

I had problems with splitting Strings in Java with the split()-method. Is it possible to declare an Array before initializing it through the split()-method? Or ist there another solution for splitting Strings?

7th Mar 2018, 10:35 PM
leokleinchen
1 Réponse
+ 7
char [] s = new char [str.length]; s = str.toCharArray();
7th Mar 2018, 10:53 PM
Vukan
Vukan - avatar