NSString

出自ZOZ Wiki

跳转到: 导航, 搜索

NSString Class Reference

Inherits from NSObject
Conforms to
Framework /System/Library/Frameworks/Foundation.framework
Availability Available in iPhone OS 2.0 and later.
Declared in
  • NSPathUtilities.h
  • NSString.h
  • NSURL.h
Companion guides
  • String Programming Guide for Cocoa
  • Property List Programming Guide
Related sample code


Class Methods

stringWithFormat

Returns a string created by using a given format string as a template into which the remaining argument values are substituted.

   + (id)stringWithFormat:(NSString *)format, ...

Parameters format

A format string. See Formatting String Objects for examples of how to use this method, and String Format Specifiers for a list of format specifiers. This value must not be nil.

  Important: Raises an NSInvalidArgumentException if format is nil.

... A comma-separated list of arguments to substitute into format.

Return Value

A string created by using format as a template into which the remaining argument values are substituted according to the canonical locale.

Discussion

This method is similar to localizedStringWithFormat:, but using the canonical locale to format numbers. This is useful, for example, if you want to produce “non-localized” formatting which needs to be written out to files and parsed back later.

Availability

Available in iPhone OS 2.0 and later.

See Also

  • – initWithFormat:
  • + localizedStringWithFormat:

Related Sample Code

Declared In

NSString.h

待完善

个人工具