CFStringGetIntValueHeader: CFString.h

Obtains the integer value represented by a CFString object.

SInt32 CFStringGetIntValue (
    CFStringRef str
);
str

Pass a reference to a CFString object that represents a signed integer value. If the object includes characters other than ASCII numbers or valid sign characters ('+' or '-"), a scanning error results and 0 is returned.

function result

A signed integer that is the value represented by the CFString object. The result is 0 if there is a scanning error or INT_MAX or INT_MIN if there is an overflow error.

DISCUSSION

The CFStringGetIntValue yields the numeric value represented by a CFString object as an integer. Consider the following example:

SInt32 val = CFStringGetIntValue(CFSTR("-123"));

The variable val in this example would contain the value -123 after the function is called.

The characters in the evaluated CFString object must be either ASCII numbers or a sign character ('+' or '-"); otherwise a scanning error results.


© 1999 Apple Computer, Inc. — (Last Updated 9/15/99)