beetlebug▾
/

text replace

Replaces the content from INDEX1 up to INDEX2 with new text.

PATHNAME replace INDEX1 INDEX2 TEXT ?TAGS? ?TEXT TAGS ...?

Description

Deletes the range as delete does, and inserts the new text at INDEX1 as insert does. With -undo 1, the two changes are one edit of the undo stack.

Returns

An empty string.

Examples

% text .rp
> .rp insert end "hello world"
> .rp replace 1.0 1.5 HELLO
> .rp get 1.0 1.end
HELLO world

Errors

% text .rp2; .rp2 replace 1.0
wrong # args: should be ".rp2 replace index1 index2 chars ?tagList chars tagList ...?"
-errorcode NONE

Facts

Capability
None.
Tcl release
Tcl 9.1 and 8.6.
Since
ztk 1.0.0-beta.1

See also