Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2006-12-14
21:25 • Closed ticket [1615277fff]: string equal example wrong in doc plus 3 other c... artifact: eeef11d789 user: dkf
04:24 • Ticket [1615277fff]: 1 change artifact: 9f28d3ebae user: escargo
2006-12-13
21:23 • New ticket [1615277fff]. artifact: e79ccb3013 user: escargo

string equal example wrong in doc

Closed / Fixed1615277fffffffffffffffffffffffffffffffffCreated 20 years agoUpdated 20 years ago
Descriptionplain2006-12-13 21:23:29
The following code appears in the documentation for string, as an example of using string equal:

Test if the string in the variable string is a proper non-empty prefix of the string foobar. 
set length [string length $string]
if {$length == 0} {
   set isPrefix 0
} else {
   set isPrefix [string equal -length $string $string "foobar"]
}

It has an unnoticed bug: the variable after the -length should be $length, not $string.
escargo Ticket [1615277fff]: 1 change [History diff]2006-12-14 04:24:19
dkf Closed ticket [1615277fff]. [History diff]2006-12-14 21:25:21
Log in (anonymous is fine) to add a comment.