Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

[Bug Tcl 8.2] "format" command produces errorneous result

0 views
Skip to first unread message

scriptic...@auto.genned.post

unread,
Sep 21, 1999, 3:00:00 AM9/21/99
to

Tcl 8.2 Bug: Generated by Scriptics' bug entry form at
http://www.scriptics.com/support/bugForm.html
Responses to this post are encouraged.
------

Submitted by: Hai S. Vu
OperatingSystem: Windows NT
Synopsis: "format" command produces errorneous result

ReproducibleScript:
The following command
% format "%07s" "123"
returns string " 123" (leading spaces)
instead of string "0000123" (leading zeros)
I didn't have this problem in TCL 8.0

Scott Redman

unread,
Sep 21, 1999, 3:00:00 AM9/21/99
to
Nope, correct behavior, you want:

format "%07d" "123"

Using the "0-padding" with strings is undefined
in ANSI C, and it's behavior in Tcl used to be
subject to that restriction. It's current behavior
is undocumented and undefined. Jeff Hobbs is in the
process of changing either the implementation
or the docs.

-- Scott

0 new messages