Contents

initWithFormat:

Returns an NSString object initialized by using a given format string as a template into which the remaining argument values are substituted.

Declaration

- (instancetype) initWithFormat:(NSString *) format;

Parameters

  • format:

    A format string. See 20000943 for examples of how to use this method, and TP40004265 for a list of format specifiers. This value must not be nil.

Return Value

An NSString object initialized by using format as a template into which the remaining argument values are substituted according to the system locale. The returned object may be different from the original receiver.

Discussion

Pass a comma-separated list of variadic arguments to substitute into format.

This method invokes init(format:locale:arguments:) without applying any localization. This is useful, for example, when working with fixed-format representations of information that is written out and read back in at a later time.

See Also

Creating and Initializing Strings