duny macrumors newbie Original poster Sep 21, 2008 26 0 H-Town Jul 30, 2009 #1 How do I concatenate two integers together, say i have 2 and 30 and want to make 230.
PhoneyDeveloper macrumors 68040 Sep 2, 2008 3,114 93 Jul 30, 2009 #2 Do you want the result to be an integer or a string? If a string, look at stringWithFormat.
D drivefast macrumors regular Mar 13, 2008 128 0 Jul 30, 2009 #3 ... and if integer, it's 2 * 100 + 30.
LTX macrumors regular Dec 25, 2008 164 0 Vancouver, BC, Canada Jul 30, 2009 #4 drivefast said: ... and if integer, it's 2 * 100 + 30. Click to expand... That's only going to work for a very small set of number pairs. It wouldn't, for example, work with 300 and 999 to make 300999. You would get 30999.
drivefast said: ... and if integer, it's 2 * 100 + 30. Click to expand... That's only going to work for a very small set of number pairs. It wouldn't, for example, work with 300 and 999 to make 300999. You would get 30999.
mccannmarc macrumors 6502 Aug 15, 2008 270 0 Manchester, UK Jul 31, 2009 #5 You would have to make the 2 values NSString's and concatenate them into one NSString. You can then get the int value from the string using the NSString's integerValue getter
You would have to make the 2 values NSString's and concatenate them into one NSString. You can then get the int value from the string using the NSString's integerValue getter
T Troglodyte macrumors member Jul 2, 2009 92 0 Jul 31, 2009 #6 Code: int combinedInt=[[NSString stringWithFormat:@"%i%i", int1, int2] intValue];
dejo Moderator emeritus Sep 2, 2004 15,982 452 The Centennial State Jul 31, 2009 #7 I think before we spit out any more solutions we need the OP to come back and clarify what it is that they want.
I think before we spit out any more solutions we need the OP to come back and clarify what it is that they want.