Write a replaceTokensWithStrings: method with varargs <p>I want to do the following:</p> <pre><code>["Hello &lt;firstname&gt; &lt;middlename&gt; &lt;lastname&gt;". replaceTokensWithStrings: @"firstname", someFirstName, @"middlename", middleNameMightBeNilObject, @"lastname", lastNameObject]; </code></pre> <p>It looks like this is not possible because of the "<code>nil</code> as a terminator problem". </p> <p>However <code>NSLog</code> also takes multiple arguments and can handle <code>nil</code> as parameters too:</p> <pre><code>NSString *nilValue = nil; NSLog(@"Value of nilValue=%@", nilValue); </code></pre> <p>output</p> <pre><code>Value of nilValue=(null) </code></pre> <p>So how can I achieve this in my <code>replaceTokensWithStrings:...</code> method?</p> <p><strong>Update: The signature of my method:</strong></p> <pre><code>-(NSString *)replaceTokensWithStrings:(NSString *)input, ... NS_SOMETHING_SPECIAL_HERE{ </code></pre>