CFString Reference

The CFString type defines opaque objects representing strings. More...

## Detailed Description

CFString is "toll-free bridged" to NSString.

## Macros

#define | kCFStringEncodingInvalidId (0xffffffffU)
#define | CFSTR(x) __CFStringMakeConstantString("" x "")
| Creates a constant string object.

## Typedefs

typedef const struct __CFString * | CFStringRef
typedef UInt32 | CFStringEncoding

## Enumerations

enum | CFStringCompareFlags { kCFCompareCaseInsensitive = 1 , kCFCompareBackwards = 4 , kCFCompareAnchored = 8 , kCFCompareNonliteral = 16 , kCFCompareLocalized = 32 , kCFCompareNumerically = 64 , kCFCompareDiacriticInsensitive = 128 , kCFCompareWidthInsensitive = 256 , kCFCompareForcedOrdering = 512 }

enum

CFStringBuiltInEncodings {
kCFStringEncodingMacRoman = 0 , kCFStringEncodingWindowsLatin1 = 0x0500 , kCFStringEncodingISOLatin1 = 0x0201 , kCFStringEncodingNextStepLatin = 0x0B01 ,
kCFStringEncodingASCII = 0x0600 , kCFStringEncodingUnicode = 0x0100 , kCFStringEncodingUTF8 = 0x08000100 , kCFStringEncodingNonLossyASCII = 0x0BFF ,
kCFStringEncodingUTF16 = 0x0100 , kCFStringEncodingUTF16BE = 0x10000100 , kCFStringEncodingUTF16LE = 0x14000100 , kCFStringEncodingUTF32 = 0x0c000100 ,
kCFStringEncodingUTF32BE = 0x18000100 , kCFStringEncodingUTF32LE = 0x1c000100
}

## Functions

CFStringRef | __CFStringMakeConstantString (const char *str) GS_PURE_FUNCTION

## Creating a CFString

CFArrayRef | CFStringCreateArrayBySeparatingStrings (CFAllocatorRef alloc, CFStringRef theString, CFStringRef separatorString)
CFStringRef | CFStringCreateByCombiningStrings (CFAllocatorRef alloc, CFArrayRef theArray, CFStringRef separatorString)
CFStringRef | CFStringCreateCopy (CFAllocatorRef alloc, CFStringRef theString)
CFStringRef | CFStringCreateFromExternalRepresentation (CFAllocatorRef alloc, CFDataRef data, CFStringEncoding encoding)
CFStringRef | CFStringCreateWithBytes (CFAllocatorRef alloc, const UInt8 *bytes, CFIndex numBytes, CFStringEncoding encoding, Boolean isExternalRepresentation)
CFStringRef | CFStringCreateWithCharacters (CFAllocatorRef alloc, const UniChar *chars, CFIndex numChars)
CFStringRef | CFStringCreateWithCharactersNoCopy (CFAllocatorRef alloc, const UniChar *chars, CFIndex numChars, CFAllocatorRef contentsDeallocator)
CFStringRef | CFStringCreateWithCString (CFAllocatorRef alloc, const char *cStr, CFStringEncoding encoding)
CFStringRef | CFStringCreateWithCStringNoCopy (CFAllocatorRef alloc, const char *cStr, CFStringEncoding encoding, CFAllocatorRef contentsDeallocator)
CFStringRef | CFStringCreateWithFormat (CFAllocatorRef alloc, CFDictionaryRef formatOptions, CFStringRef format,...)
CFStringRef | CFStringCreateWithFormatAndArguments (CFAllocatorRef alloc, CFDictionaryRef formatOptions, CFStringRef format, va_list arguments)
CFStringRef | CFStringCreateWithSubstring (CFAllocatorRef alloc, CFStringRef str, CFRange range)
CFStringRef | CFStringCreateWithFileSystemRepresentation (CFAllocatorRef alloc, const char *buffer)
CFStringRef | CFStringCreateWithBytesNoCopy (CFAllocatorRef alloc, const UInt8 *bytes, CFIndex numBytes, CFStringEncoding encoding, Boolean isExternalReprentation, CFAllocatorRef contentsDeallocator)

## Searching CFStrings

CFArrayRef | CFStringCreateArrayWithFindResults (CFAllocatorRef alloc, CFStringRef theString, CFStringRef stringToFind, CFRange rangeToSearch, CFStringCompareFlags compareOptions)
CFRange | CFStringFind (CFStringRef theString, CFStringRef stringToFind, CFStringCompareFlags compareOptions)
Boolean | CFStringFindWithOptions (CFStringRef theString, CFStringRef stringToFind, CFRange rangeToSearch, CFStringCompareFlags searchOptions, CFRange *result)
Boolean | CFStringFindWithOptionsAndLocale (CFStringRef theString, CFStringRef stringToFind, CFRange rangeToSearch, CFStringCompareFlags searchOptions, CFLocaleRef locale, CFRange *result)
void | CFStringGetLineBounds (CFStringRef theString, CFRange range, CFIndex *lineBeginIndex, CFIndex *lineEndIndex, CFIndex *contentsEndIndex)
Boolean | CFStringFindCharacterFromSet (CFStringRef theString, CFCharacterSetRef theSet, CFRange rangeToSearch, CFStringCompareFlags searchOptions, CFRange *result)
void | CFStringGetParagraphBounds (CFStringRef string, CFRange range, CFIndex *parBeginIndex, CFIndex *parEndIndex, CFIndex *contentsEndIndex)

## Comparing String

CFComparisonResult | CFStringCompare (CFStringRef theString1, CFStringRef theString2, CFStringCompareFlags compareOptions)
CFComparisonResult | CFStringCompareWithOptions (CFStringRef theString1, CFStringRef theString2, CFRange rangeToCOmpare, CFStringCompareFlags compareOptions)
Boolean | CFStringHasPrefix (CFStringRef theString, CFStringRef prefix)
Boolean | CFStringHasSuffix (CFStringRef theString, CFStringRef suffix)
CFComparisonResult | CFStringCompareWithOptionsAndLocale (CFStringRef theString1, CFStringRef theString2, CFRange rangeToCOmpare, CFStringCompareFlags compareOptions, CFLocaleRef locale)

## Accessing Characters

CFDataRef | CFStringCreateExternalRepresentation (CFAllocatorRef alloc, CFStringRef theString, CFStringEncoding encoding, UInt8 lossByte)
CFIndex | CFStringGetBytes (CFStringRef theString, CFRange range, CFStringEncoding encoding, UInt8 lossByte, Boolean isExternalRepresentation, UInt8 *buffer, CFIndex maxBufLen, CFIndex *usedBufLen)
UniChar | CFStringGetCharacterAtIndex (CFStringRef theString, CFIndex idx)
void | CFStringGetCharacters (CFStringRef theString, CFRange range, UniChar *buffer)
const UniChar * | CFStringGetCharactersPtr (CFStringRef theString)
Boolean | CFStringGetCString (CFStringRef theString, char *buffer, CFIndex bufferSize, CFStringEncoding encoding)
const char * | CFStringGetCStringPtr (CFStringRef theString, CFStringEncoding encoding)
CFIndex | CFStringGetLength (CFStringRef str)
CFRange | CFStringGetRangeOfComposedCharactersAtIndex (CFStringRef theString, CFIndex theIndex)
UTF32Char | CFStringGetLongCharacterForSurrogatePair (UniChar surrogateHigh, UniChar surrogateLow)
Boolean | CFStringGetSurrogatePairForLongCharacter (UTF32Char character, UniChar *surrogates)
Boolean | CFStringIsSurrogateHighCharacter (UniChar character)
Boolean | CFStringIsSurrogateLowCharacter (UniChar character)

## Working with Encodings

CFStringRef | CFStringConvertEncodingToIANACharSetName (CFStringEncoding encoding)
unsigned long | CFStringConvertEncodingToNSStringEncoding (CFStringEncoding encoding)
UInt32 | CFStringConvertEncodingToWindowsCodepage (CFStringEncoding encoding)
CFStringEncoding | CFStringConvertIANACharSetNameToEncoding (CFStringRef theString)
CFStringEncoding | CFStringConvertNSStringEncodingToEncoding (unsigned long encoding)
CFStringEncoding | CFStringConvertWindowsCodepageToEncoding (UInt32 codepage)
CFStringEncoding | CFStringGetFastestEncoding (CFStringRef theString)
const CFStringEncoding * | CFStringGetListOfAvailableEncodings (void)
CFIndex | CFStringGetMaximumSizeForEncoding (CFIndex length, CFStringEncoding encoding)
CFStringEncoding | CFStringGetMostCompatibleMacStringEncoding (CFStringEncoding encoding)
CFStringRef | CFStringGetNameOfEncoding (CFStringEncoding encoding)
CFStringEncoding | CFStringGetSmallestEncoding (CFStringRef theString)
CFStringEncoding | CFStringGetSystemEncoding (void)
Boolean | CFStringIsEncodingAvailable (CFStringEncoding encoding)
Boolean | CFStringGetFileSystemRepresentation (CFStringRef string, char *buffer, CFIndex maxBufLen)
CFIndex | CFStringGetMaximumSizeOfFileSystemRepresentation (CFStringRef string)

## Getting Numeric Values

double | CFStringGetDoubleValue (CFStringRef str)
SInt32 | CFStringGetIntValue (CFStringRef str)

## Getting String Properties

void | CFShow (CFTypeRef obj)
void | CFShowStr (CFStringRef str)
CFTypeID | CFStringGetTypeID (void)

## Pascal Strings

CFStringRef | CFStringCreateWithPascalString (CFAllocatorRef alloc, ConstStr255Param pStr, CFStringEncoding encoding)
CFStringRef | CFStringCreateWithPascalStringNoCopy (CFAllocatorRef alloc, ConstStr255Param pStr, CFStringEncoding encoding, CFAllocatorRef contentsDeallocate)
Boolean | CFStringGetPascalString (CFStringRef theString, StringPtr buffer, CFIndex bufferSize, CFStringEncoding encoding)
ConstStringPtr | CFStringGetPascalStringPtr (CFStringRef theString, CFStringEncoding encoding)

## Macro Definition Documentation

## CFSTR

#define CFSTR | ( |  | x | ) | __CFStringMakeConstantString("" x "")

Note
  This macro will create the constant string at runtime.

Examples
  EXUInt32.c.