TIP #241 Version 1.1: Case-Insensitive List Searching and Sorting

This is not necessarily the current version of this TIP.


TIP:241
Title:Case-Insensitive List Searching and Sorting
Version:$Revision: 1.1 $
Author:Joe Mistachkin <joe at mistachkin dot com>
State:Draft
Type:Project
Tcl-Version:8.5
Vote:Pending
Created:Saturday, 26 February 2005
Keywords:Tcl, sorted lists

Abstract

This TIP proposes a -nocase option for the lsearch and lsort commands to allow for case-insensitive handling of the specified list.

Rationale

The lsearch and lsort commands are very flexible and powerful. However, in certain situations the ability to perform case-insensitive searching and sorting is absolutely required (such as searching fully qualified file names on file systems that do not differentiate between upper and lower case). Without the -nocase option, various unnatural workarounds are required. In addition, the -nocase option will finally bring the lsearch command into parity with the other comparison related operations, including string compare, string match, and regexp.

Specification

Options will be added like this:

lsearch ?-nocase? list pattern

lsort ?-nocase? list

For lsearch, the -nocase option can be used with the -ascii, -exact, -glob, and -regexp options. It indicates that the string of the found entry of list should match pattern case-insensitively. It is compatible with the -all, -decreasing, -increasing, -inline, -not and -start options.

For lsort, the -nocase option can be used with the -ascii option. It indicates that the list should be sorted based on a case-insensitive ordering. It is compatible with the -decreasing, -increasing, -index and -unique options.

For both lsearch and lsort, the -nocase option has no effect when used with the -dictionary, -integer, or -real options. For lsort, the -nocase option has no effect when used with the -command option.

Reference Implementation

A reference implementation of this TIP is availble [1].

Copyright

This document has been placed in the public domain.


Powered by TclThis is not necessarily the current version of this TIP.

TIP AutoGenerator - written by Donal K. Fellows