Instance Method

replaceCharactersInRange:withString:

Replaces the characters in the given range with the characters of the given string.

Declaration

- (void)replaceCharactersInRange:(NSRange)range withString:(NSString *)str;

Parameters

aRange

A range specifying the characters to replace.

aString

A string specifying the characters to replace those in aRange.

Discussion

The new characters inherit the attributes of the first replaced character from aRange. Where the length of aRange is 0, the new characters inherit the attributes of the character preceding aRange if it has any, otherwise of the character following aRange.

Raises an NSRangeException if any part of aRange lies beyond the end of the receiver’s characters.

See Also

Changing characters

deleteCharactersInRange:

Deletes the characters in the given range along with their associated attributes.