Question

why are we using here 5 parameters for stringWithFormat :

return [NSString stringWithFormat:NSLocalizedString(@"LatLongFormat", @"LatLongFormat"), fabs(self.coordinate.latitude), latString, fabs(self.coordinate.longitude), lonString];

i guess the second param is the value for the third param, the key, but what about the first parameter?

Thanks for your answer

Was it helpful?

Solution

I'm not sure i understand well your question but you can use as many parameters as you want for stringWithformat method. It will build a string according to these parameters.

NSString *myString = [NSString stringWithFormat:@"I %@ %d nice %@",@"build",1,@"string"]

mystring will contain "I build 1 nice string".

OTHER TIPS

The first parameter is the format used for formatting the remaining parameters.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top