Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
yashchitneni
319 PointsAssigning an int to a String
If I was to have a set of edittexts which take in Strings and have an another set of edittexts which take in ints how would I make it so that the int is assigned to the String.
For instance, the first edittext the user types in "Bob" and the second one the user types in 3. How would I assign 3 to Bob?
1 Answer
Dennis Skoko
12,860 Pointsuse javas Integer.toString() function to convert int to string
so for example: string name = "bob"; int nr = 3;
so the result could be: combined = name + " " + Integer.toString(nr);
This would produce so that combined contains "Bob 3"
yashchitneni
319 Pointsyashchitneni
319 PointsThanks a lot, Dennis!