Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Add ?-nocase? to string first and string last

Closed / Postponed772250ffffffffffffffffffffffffffffffffffCreated 23 years agoUpdated 18 years ago
Descriptionplain2003-07-16 12:06:39
Actually, if you need a case unsensitive search with string first 
or string last commands, you have to do like this :

string first [string tolower $string1] [string tolower $string2]

or

string last [string tolower $string1] [string tolower $string2]

I think an optionnal -nocase doing the same thing would be
very usefull:

string first ?-nocase? string1 string2 ?startIndex?

or

string last ?-nocase? string1 string2 ?lastIndex?
jenglishplain2003-09-06 09:23:08
Logged In: YES 
user_id=68433

This can't be added in this fashion without introducing an
ambiguity.  Consider:

string first $pattern $string $index

when $pattern happens to be the string "-nocase"

(As a general rule, if a command takes optional arguments,
you really shouldn't later add switches, and vice versa.)
dkfplain2009-01-30 20:59:46
Plus there's the problem of you needing to specify the case-folding rules to use - it's locale-specific.

I'm going to close this in favour of a big "add locale support" project at some point.
dkfplain2009-01-30 20:59:47
allow_comments - 1
Log in (anonymous is fine) to add a comment.