Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2015-05-18
14:41 • Ticket [3608714fff] string replace refuses to replace empty substrings sta... artifact: c4c1c4d4d7 user: dgp
07:55 • Ticket [3608714fff]: 3 changes artifact: 496c5acf9f user: dkf
2015-02-18
21:58 • Ticket [3608714fff]: 3 changes artifact: 2d90ef6e45 user: dgp
21:49 • Ticket [3608714fff]: 4 changes artifact: 5645fea12f user: dkf
20:45 • Ticket [3608714fff]: 6 changes artifact: 9f4e855f1e user: dgp
2013-04-10
21:18 • Ticket [3608714fff]: 4 changes artifact: de0e97def0 user: dgp
2013-03-21
14:11 • New ticket [3608714fff]. artifact: 7dc6c9ad32 user: dgp

[string replace] refuses to replace empty substrings

Open3608714fffffffffffffffffffffffffffffffffCreated 14 years agoUpdated 12 years ago
Descriptionplain2013-03-21 14:11:51
Can't believe I missed this.  Should have been part
of the Do Nothing Gracefully cleanup.

You cannot use [string replace] to insert a substring
without at the same time taking at least on character
out.

% string replace abcde 1 0 h
abcde

Instead of the result any sane programmer would
expect:

ahbcde

In particular, the useful case of prepending is not
supported.

Recategorize to a Feature Request if you must.  (This
misfeature is documented, FFS).  But it's so boneheaded
it looks like a bug to me.
dgpplain2013-04-10 21:18:06
See branch bug-3608714.

Surprising thing is that the test suite does not care.
dgpplain2015-02-18 20:45:35
See also:

https://sourceforge.net/p/tcl/mailman/message/20466029/
dkfhtml2015-02-18 21:49:17

Bug-by-design? Meh. While I think this is something that will need flagging up as a change when it gets done, it can probably go on the 8.6 track as who in their right mind would be relying on the current behaviour?

dgpplain2015-02-18 21:58:00
I no longer recall, but whatever it was, it was enough
to suspend the feature change at the time.

I'd start looking with tcllib.
dkf Ticket [3608714fff]: 3 changes [History diff]2015-05-18 07:55:38
dgpplain2015-05-18 14:41:33
bug-3608714 branch updated.
Log in (anonymous is fine) to add a comment.