Soham1087
Banned
I'm trying to convert a String to an array of Character class objects, but I'm having trouble. I know that the toCharArray() method can convert a String to an array of primitive datatype type "char," but it doesn't help me convert a String to an array of objects of Character type.
To convert char to Character, use Character.valueOf in this article about converting string to array from scaler topics. Is that right? How should I go about it?
The code suggested by them:
To convert char to Character, use Character.valueOf in this article about converting string to array from scaler topics. Is that right? How should I go about it?
The code suggested by them:
Code:
String str = "testString";
char[] charArray = str.toCharArray();
Character[] charObjectArray = ArrayUtils.toObject(charArray);