From: Reinhard M. <ma...@tc...> - 2006-01-31 13:31:35
|
Hi, On Tue, 31 Jan 2006 at 13:18, Neil Madden wrote: > I'd vote for directly into the "fileutil" namespace. me too. I see no need here to make the command names even longer by adding a level of sub-namespaces. > Perhaps mapfile or filemap or even just map (i.e. [fileutil::map]) > as it is quite similar to [string map]? The copy version can be done > as an option: fileutil map -copy $outfile $infile key val ... How about this signature? fileutil::map {key value ...} infile ?outfile? It would be a mixture of [string map] (regarding the mapping list) and [regsub] (regarding the optional "to" argument). Off-topic remark: maybe even [string map] could be extended to allow an optional "out" argument, so set x [string map $map $y] would become string map $map $x y ... and the return value of the command could be the number of replacements that have been done, as it is with [regsub] cu Reinhard |