4

Is there any function to do this kind of job or do one have to parse each char and add it to the array?

4 Answers 4

15

Use String#toCharArray().

char[] chars = "some string".toCharArray();
Sign up to request clarification or add additional context in comments.

1 Comment

Damn! 14 seconds! +1 because I don't want to be a sore loser :-)
4
"read java docs".toCharArray();

Comments

1

Use the String.toCharArray() method.

Comments

0

Use the String.getChars() method.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.