Artifacts Associated With Ticket 218751ffffffffff
Ticket change [dd3fe363bd] (rid 114636) by nobody on 2000-10-26 01:04:56:
- assignee initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
OriginalBugID: 1992 RFE Version: 8.1 SubmitDate: '1999-05-05' LastModified: '1999-05-07' Severity: LOW Status: Released Submitter: pat ChangedBy: stanton OS: Solaris OSVersion: 2.5.1 Machine: Other FixedDate: '1999-05-07' FixedInVersion: 8.1.1 ClosedDate: '2000-10-25' Name: Jeffrey Hobbs Comments: The implementations were done to maintain 100% backwards compatibility with working code (changing the options to an arg can obviously change what error strings arise), and reduce any loss of speed (the only method that actually attained a speed loss was string index, as I throw a Tcl_NumUtfChars call in to support end-1 like indices, and that is not major). DesiredBehavior: This is related to the previous feature request for an updated string command, with one new method (string is) and patched against 8.1.0. To cover it all again, I have made the following mods: * string compare now takes optional length arg (for strncmp behavior) * added string equal (just a few lines of code blended in with string compare) * added string icompare/iequal for case-insensitive comparisons * string index's index can now be ?end[+-]?expression I made this change in the private TclGetIntForIndex, which means that the list commands also benefit, as well as string range, et al. * added string is <class> ?-strict? ?-failindex varname? string The following are valid classes: alnum, alpha, ascii, boolean, digit, double, false, integer, lower, space, true, upper, wordchar Most of the correspond to the std is*() C functions. Those that are missing (like iscntrl()) are due to a lack of Tcl_UniCharIs*() equivalent, but could be added. I chose not to mess with adding them, as that means going in and setting things in the stub tables and such. However, they are not complicated (zB, *IsControl() is a one liner). Those that do not correspond to is*() (like boolean, int, ...) are intelligently handled to return the correct value, but the command is written such that no type conversion of the passed object occurs (a good thing, I believe). For integer and double, this was tricky, but the test suite is full, and the C code is well-commented with the purpose. With the exception of int/double, which are inherently in Tcl not unicode safe (still calls to strto*), all of these are unicode safe (with tests). * added [string repeat string count] Repeats given string <count> number of times * added string replace, quasi string equiv to lreplace (quasi opposite of string range): string replace first last ?string? Example of use, replacing end of string with ... should the string be more than 16 chars long: string replace $string 16 end "..." This just returns the string len < 16, so it will only affect the long strings. * added optional first and last args to string to* This allows you to just affect certain regions of a string with the command (like just capping the first letter). I found the original totitle to be too draconian to be useful. * added [string map charMap string] where charMap is a {from to from to} list that equates to what one might get from [array get]. Each <from> and <to> can be multiple chars (or none at all). For Tcl/CGI users, this is a MAJOR speed booster. Patch: The patch comes to 100KB with full doc and test suite changes against the Tcl 8.1.0 sources. http://www.hobbs.wservice.com/tcl/capp/Tcl81-string.txt PatchFiles: C: tclUtil.c && tclCmdMZ.c doc: string.n tests: string.test cmd*.test l*.test error.test - foundin initialized to: "obsolete: 8.1"
- priority initialized to: "5 Medium"
- resolution initialized to: "None"
- status initialized to: "Open"
- submitter initialized to: "nobody"
- subsystem initialized to: "69. Other"
- title initialized to: "Updated string command, take 2"
- type initialized to: "RFE"
Ticket change [52a5e640d0] (rid 126349) by welch on 2000-10-26 08:28:13:
- closedate changed to: "2000-10-26T01:28:13"
- closer changed to: "welch"
- priority changed to: "2"
- resolution changed to: "Fixed"
- status changed to: "Closed"
Ticket change [fee5f3c7b2] (rid 108667) by dgp on 2001-04-18 06:54:21:
- foundin changed to: "None"
- status changed to: "Open"
- subsystem changed to: "None"
Ticket change [603a7b105f] (rid 115955) by dgp on 2001-04-18 06:54:53:
- closedate changed to: "2001-04-17T23:54:53"
- closer changed to: "dgp"
- status changed to: "Closed"
- subsystem changed to: "18. Commands M-Z"