| Ticket UUID: | 8cd74c5cd2e93ad82b6913847a08381977eaefc3 | ||
| Title: | 2-argument string toupper/tolower/totitle doesn't work as documented | ||
| Type: | Bug | Created on: | 2025-07-12 16:36:22 |
| Submitter: | jan.nijtmans | Assigned to: | jan.nijtmans |
| Subsystem: | 18. Commands M-Z | Severity: | Minor |
| Priority: | 5 Medium | Last modified: | 2025-07-13 08:32:24 |
| Status: | Closed | Closed by: | jan.nijtmans |
| Resolution: | Fixed | Closed on: | 2025-07-13 08:32:24 |
| Version: | |||
| Description: | ||||
|
According to the documentation: If first is specified, it refers to the first char index in the string to start modifyingThe documentation doesn't specify what happens if _last_ is not specified, but this suggests that modification of the string will be done until the end (just as when neither _first_ and _last_ are specified). That's not what happens: $ tclsh8.6 % string tolower ABC 1 AbCReading the documentation, I would expect "Abc" as the answer. So, either the documentation or the implementation should change. I'm not 100% sure, but I'm leaning towards changing the documentation. | ||||
| User Comments: | ||||
jan.nijtmans added on 2025-07-12 16:48:19:
Commit [83bd3ccec5ec1208] contains both the documentation change (which adapts the documentation to the current behavior) and the implementation change (which adapts the implementation to the current documentation. Please review: Should "string tolower ABC 1" result in "Abc" (as it currently does) or "Abc" (as the documentation suggests)? I couldn't find any code which uses "string tolower/toupper/totitle", specifying _first_ but not _last_. But changing the implementation is a risk. Therefore I'm leaning towards changing the documentation. But if you don't agree with that (or if you agree with that), please let me know! sebres added on 2025-07-12 17:26:14:
I'm also for documentation change... Especially because it is pretty simple to force the change case to the end, with supplying the
@Jan, by the way, you wrote the same statement (result) for both variants, so here again (and a bit more clear example):
sebres added on 2025-07-12 17:27:53:
Even not in our test suite? That would be worse. jan.nijtmans added on 2025-07-12 19:21:03:
> Even not in our test suite? That would be worse. In our test suite, yes. But not anywhere else (not even in Tk) jan.nijtmans added on 2025-07-13 08:32:24:
Documentation updated in all branches | ||||
