TIP #188: Add 'string is wideinteger' to the 'string is' Subcommand


TIP:188
Title:Add 'string is wideinteger' to the 'string is' Subcommand
Version:$Revision: 1.7 $
Author:Kevin Kenny <kennykb at acm dot org>
State:Final
Type:Project
Tcl-Version:8.5
Vote:Done
Created:Friday, 23 April 2004
Discussions To:news:comp.lang.tcl
Keywords:Tcl

Abstract

The string command supports tests for a number of Tcl's basic types, for example, integers, doubles, and booleans. This TIP proposes adding wide integers.

Rationale

The string command includes tests for the common Tcl types: string is boolean, string is double and string is integer. Unaccountably, string is wideinteger is missing from the list, making it difficult for an input validation procedure to determine whether, in fact, a string contains a valid wide integer.

Specification

This document proposes augmenting the string is command with a string is wideinteger that functions the same as string is integer in every respect except for the fact that it accepts any string containing a substring that is valid as a wide integer (that is, acceptable to Tcl_GetWideIntFromObj) possibly surrounded by whitespace.

Reference Implementation

Patches that implement string is wideinteger, provide test cases for it, and update doc/string.n to include it are available at SourceForge as Tcl Patch #940915[1].

Copyright

Copyright 2004, by Kevin B. Kenny. Redistribution permitted under the terms of the Open Publication License [2].


Powered by Tcl[Index] [History] [HTML Format] [Source Format] [LaTeX Format] [Text Format] [XML Format] [*roff Format (experimental)] [RTF Format (experimental)]

TIP AutoGenerator - written by Donal K. Fellows