Tk Library Source Code

View Ticket
Login
Ticket UUID: 837818
Title: Quoting module
Type: RFE Version: None
Submitter: dkf Created on: 2003-11-07 11:38:15
Subsystem: tcllib: request for new module Assigned To: nobody
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2013-07-04 17:25:47
Resolution: Not Applicable Here Closed By:
    Closed on:
Description:
It'd be very nice if we could have a module to help
with those trickier quoting tasks that newbies get
slightly wrong.  Here's some example code adapted from
a discussion on the chat...

proc makeMap {} {
   set chars {{[\"$#; ]}}
   append chars \t
   set map [list \n \\n]
   foreach c [split $chars {}] {lappend map $c \\$c}
   return $map
}

variable addBackslashMap [makeMap]
proc backslashQuote {string} {
   variable addBackslashMap
   string map $addBackslashMap $string
}
proc braceQuote {string} {
   list $string
}

There's probably other things that could be added too.