Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Java String to "Character" Array Conversion

Status
Not open for further replies.

Soham1087

Banned
Joined
May 31, 2022
Messages
17
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Location
India
Activity points
185
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:
Code:
String str = "testString";
char[] charArray = str.toCharArray();
Character[] charObjectArray = ArrayUtils.toObject(charArray);
 

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.

The above code seems doing what is supposed to do.
What exactly is expected and what is actually going 'wrong' ?
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top