Iphone 如何使用CFStringAppend附加不同的字符串?

Iphone 如何使用CFStringAppend附加不同的字符串?,iphone,Iphone,尽早告诉我 谢谢为什么要使用CFMutableStrings和CFStrings而不是NSSString 回答你的问题: CFMutableStringRef mutableString = CFStringCreateMutable(NULL, 0); if (mutableString) { CFStringAppend(mutableString, CFSTR("the first part of my string"));

尽早告诉我
谢谢

为什么要使用CFMutableStrings和CFStrings而不是NSSString

回答你的问题:

    CFMutableStringRef mutableString = CFStringCreateMutable(NULL, 0);

    if (mutableString) {

            CFStringAppend(mutableString, CFSTR("the first part of my string"));
            CFStringAppend(mutableString, myString);

     }
以下是Apple文档条目:

CFStringAppend
Appends the characters of a string to those of a CFMutableString object.

void CFStringAppend (
   CFMutableStringRef theString,
   CFStringRef appendedString
);
Parameters
theString
The string to which appendedString is appended. If theString is not a CFMutableString object, an assertion is raised.

appendedString
The string to append.

Discussion
This function reallocates the backing store of theString to accommodate the new length.

Availability
Available in iPhone OS 2.0 and later.
Declared In
CFString.h

为什么要使用CFMutableStrings和CFStrings而不是NSSString

回答你的问题:

    CFMutableStringRef mutableString = CFStringCreateMutable(NULL, 0);

    if (mutableString) {

            CFStringAppend(mutableString, CFSTR("the first part of my string"));
            CFStringAppend(mutableString, myString);

     }
以下是Apple文档条目:

CFStringAppend
Appends the characters of a string to those of a CFMutableString object.

void CFStringAppend (
   CFMutableStringRef theString,
   CFStringRef appendedString
);
Parameters
theString
The string to which appendedString is appended. If theString is not a CFMutableString object, an assertion is raised.

appendedString
The string to append.

Discussion
This function reallocates the backing store of theString to accommodate the new length.

Availability
Available in iPhone OS 2.0 and later.
Declared In
CFString.h
说“尽可能早地告诉我”不会有帮助…说“尽可能早地告诉我”不会有帮助。。。。