0

I want a user to input a word like hello and I want to split the word into an array of individual characters, like ["h", "e", "l", "l", "o"].

I've already tried the String#split() method, but I don't know what argument to use to split each letter.

George Hilliard
  • 14,464
  • 7
  • 56
  • 92
Zoran Savic
  • 11
  • 1
  • 1
  • 1

1 Answers1

-1
String s = "Hello";
char[] s_splitted = s.toCharArray();

Outputs an array with H as the first value, e as the second, etc.

luanjot
  • 1,166
  • 1
  • 7
  • 21