Source Code : 
//this is the way of passing multiple params
+(NSIntegerwriteWithFormat: (NSString*) formatString, ... {
va_list va//this will contain the list of parameters
NSInteger length;
//get all args, but last writen arg thats formatString.
//string with format plus all arguments
NSStringstr =[ [ NSString alloc initWithFormat:formatString arguments:va ]; 
va_end(va); //finish the parsing of arguments
printf("%s\n",[ str UTF8String ]); //output to the console
length = [ str length ]; //know the lenght of the string in characters

[Login or Register to remove this advertisement]

str release ]; //relase the string
return length//return the amount of characters writen to the console

Xcode Reviewed by Xcode on . Example of Unknown Multi Params Function //this is the way of passing multiple params +(NSInteger) writeWithFormat: (NSString*) formatString, ... { va_list va; //this will contain the list of parameters NSInteger length; //get all args, but last writen arg thats formatString. va_start(va, formatString); //string with format plus all arguments NSString* str = initWithFormat:formatString arguments:va ]; va_end(va); //finish the parsing of arguments printf("%s\n",); //output to the console Rating: 5