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

change d:f:r:5 to d-f-r-5 using tcl

50 views
Skip to first unread message

johannes falcone

unread,
Jun 14, 2013, 5:23:54 PM6/14/13
to
looking at the string functions, but can't find one that does this since string replace takes a range..

Bruce Stephens

unread,
Jun 14, 2013, 5:29:09 PM6/14/13
to
johannes falcone <vispha...@gmail.com> writes:

> looking at the string functions, but can't find one that does this
> since string replace takes a range..

string map

johannes falcone

unread,
Jun 14, 2013, 5:45:10 PM6/14/13
to
% set x 08:00:27:88:FF:4E
08:00:27:88:FF:4E
% set y [string tolower $x]
08:00:27:88:ff:4e
% set z [regsub -all {:} $y {-} ]
08-00-27-88-ff-4e
% puts "01-$z"
01-08-00-27-88-ff-4e


Message has been deleted
Message has been deleted

johannes falcone

unread,
Jun 14, 2013, 5:55:26 PM6/14/13
to
% set x 08:00:27:88:ff:4E
% string map -nocase {: - F f E e} $x
% 08-00-27-88-ff-4e


hmm how to indicate all caps map to lower? [A-Z] [a-z] fails

Bruce Stephens

unread,
Jun 14, 2013, 5:55:38 PM6/14/13
to
johannes falcone <vispha...@gmail.com> writes:

> On Friday, June 14, 2013 2:49:46 PM UTC-7, johannes falcone wrote:
> % set x 08:00:27:88:ff:4E
>
> % string map -nocase {: - F f E e} $x
>
> 08-00-27-88-ff-4e

string map {: -} [string tolower $x]

[...]

johannes falcone

unread,
Jun 16, 2013, 5:50:46 AM6/16/13
to
u the man

thx
0 new messages