I realize this is an extremely low level java problem, but I've been searching and searching and I can't figure out a way to take two characters and combine them into one string.

Particularly, I have a char array and I need to take two particular elements out of it to form a String. The characters are numbers and eventually I need to convert the string into an int, if that helps cut corners at all.

Thanks for any help I receive!

EDIT: Found out I didn't need to even put the chars into a char array, problem solved.

Recommended Answers

All 2 Replies

Just a quick reminder... but if you were planning to "add" two chars together to make a String, you wouldn't get addition:

char '3' and char '7'
combined into string is "37" (not "10")
Then converting to int, and you'll get an int of 37 instead of the 10 that I assume you want

Nope, the 37 would have been what I want in the end. But thank you.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.