CFStringGetDoubleValue

Header: CFString.h Carbon status: Supported

Obtains the primary double value represented by a CFString object.

double CFStringGetDoubleValue (
    CFStringRef str
);
Parameter descriptions
str

Pass a reference to a CFString object that represents a double value. If the object includes characters other than ASCII numbers or a valid decimal character, a scanning error results when the function is called and 0.0 is returned.

function result

The double value represented by the CFString object. The result is 0.0 if there is a scanning error.

DISCUSSION

The CFStringGetDoubleValue yields the numeric value represented by a CFString object as a double value. Consider the following example:

double val = CFStringGetDoubleValue(CFSTR("0.123"));

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

The characters in the evaluated CFString object must be either ASCII numbers or a valid non-localized decimal character; otherwise a scanning error results.

AVAILABILITY

Supported in Carbon. Available in Carbon 1.0.2 and later.


© 2000 Apple Computer, Inc. (Last Updated 6/30/2000)