#3597 string equal example wrong in doc

obsolete: 8.4.14
closed-fixed
5
2006-12-14
2006-12-13
No

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.

Discussion

  • David Scott Cargo

    • summary: string length example wrong in doc --> string equal example wrong in doc
     
  • Donal K. Fellows

    • status: open --> closed-fixed