Contents

CFStringReplace(_:_:_:)

Replaces part of the character contents of a CFMutableString object with another string.

Declaration

func CFStringReplace(_ theString: CFMutableString!, _ range: CFRange, _ replacement: CFString!)

Parameters

  • theString:

    The string to modify. The characters are adjusted left or right (depending on the length of the substituted string) and the character buffer of the object is resized accordingly. If this value is not a CFMutableString object, an assertion is raised.

  • range:

    The range of characters in theString to replace.

  • replacement:

    The replacement string to put into theString.

Discussion

Although you can use this function to replace all characters in a CFMutableString object (by specifying a range of (0, CFStringGetLength(theString)) ), it is more convenient to use the CFStringReplaceAll(_:_:) function for that purpose.

See Also

CFMutableString Miscellaneous Functions