Tcl Source Code

View Ticket
Login
Ticket UUID: 654927
Title: format %n
Type: RFE Version: None
Submitter: nobody Created on: 2002-12-17 00:10:47
Subsystem: 16. Commands A-H Assigned To: dgp
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2005-11-02 00:20:06
Resolution: Out of Date Closed By: dgp
    Closed on: 2005-11-01 17:20:06
Description:
(Greg Beauchesne, [email protected])

This patch adds %n and %N specifiers to [format]. They
work like the ones for sprintf(), except you give the
name of a variable. %n is for character length, and %N
is for byte length (should byte length ever be needed)

Ex.
format "%08x%n%08x%n" 5 varlen1 10 varlen2
$varlen1 is now 8 and $varlen2 is now 16

format "%s%N" "My string" bytelen
...has nearly the same effect as:
set bytelen [string bytelength "My string"]

A simple change, but it wasn't in there, or so the
manpages told me.

Made from tcl8.4.1.
User Comments: dgp added on 2005-11-02 00:20:06:
Logged In: YES 
user_id=80530


[format] got a rewrite for 8.5, so
this patch is out of date.

dkf added on 2002-12-17 22:03:12:
Logged In: YES 
user_id=79902

This'll need a TIP before going any further.  (Don't know
what's wrong with just interpolating the results of [string
length] and [string bytelength] though.)

nobody added on 2002-12-17 07:10:48:

File Added - 37756: tcl-nformat.patch

Attachments: