NSFormatter

NSFormatter Mac OS X 10.0

This class declares an abstract interface for objects that an instance of NSCell can use to create, interpret, and validate a textual representation of the cell's contents that is suited for human readability. The Foundation framework provides two concrete classes that are used to format numeric and time and date values: NSNumberFormatter and NSDateFormatter.

figs/cocn_1341.gif

@interface NSFormatter : NSObject <NSCoding, NSCopying>
 // Instance Methods
   - (NSAttributedString *)attributedStringForObjectValue:(id)obj withDefaultAttributes:(NSDictionary *)attrs;
   - (NSString *)editingStringForObjectValue:(id)obj;
   - (BOOL)getObjectValue:(id *)obj forString:(NSString *)string errorDescription:(NSString **)error;
   - (BOOL)isPartialStringValid:(NSString *)partialString newEditingString:(NSString **)newString
        errorDescription:(NSString **)error;
   - (BOOL)isPartialStringValid:(NSString **)partialStringPtr
        proposedSelectedRange:(NSRangePointer)proposedSelRangePtr originalString:(NSString *)origString
        originalSelectedRange:(NSRange)origSelRange errorDescription:(NSString **)error;
   - (NSString *)stringForObjectValue:(id)obj;
 // Methods Implementing NSCoding
   - (void)encodeWithCoder:(NSCoder *)aCoder;
   - (id)initWithCoder:(NSCoder *)aDecoder;
 // Methods Implementing NSCopying
   - (id)copyWithZone:(NSZone *)zone;

Subclasses

NSDateFormatter, NSNumberFormatter



    Part II: API Quick Reference
    Chapter 13. Foundation Classes