I have a couple of NSStrings that hold some simple text. An example:
NSString *string1
*string2 etc
I am going to be setting the contents of those strings to a label but at random, my intention was to use the last number in the string name and arc4random. So im wondering if there is a method that would essentially be NSString stringWithStringName = @"string%i", randomInt;
Is there something that would accomplish this or would it be better to put them into an array and use objectAtIndex. Or something much more clever that hadnt occured to me?
Any input would be greatly appreciated.
What you should do is put all of the strings into an array:
Then, you can use
arc4random()to choose a random string from the array: