Removing quotes

Homepage Clovertech Forums Read Only Archives Cloverleaf General Removing quotes

  • Creator
    Topic
  • #50042
    garry r fisher
    Participant

    Hi,

    All you regexp/sub experts I need some help.

    I have a file that contains a filename in quoted text i.e. “fred.csv”. When I try and open this in my Tcl script it complains because Tcl is trying to open “”fred.csv””.

                           set ofh [open $fname w]

    So how do I remove the double quotes so I get fred rather than “fred”?

    Thanks

    Garry

Viewing 4 reply threads
  • Author
    Replies
    • #64673
      Rob Abbott
      Keymaster

      Code:

      regsub -all — “”” $data “”

      Rob Abbott
      Cloverleaf Emeritus

    • #64674
      Kevin Kinnell
      Participant

      Or (as Charlie would point out except I beat him to the punch, nyah!)

      you could use

         string map {{“} {}} $filenamestring

      –kk

    • #64675
      Kevin Kinnell
      Participant

      Whups, Mr. Abbot*:

      regsub -all {“} $data {} data

      (or wherever you decide to put the result.)

      –kevin (won’t y’all be glad when they make me start doing something productive again?) kinnell

      * always be respectful to guys with “VP” in their title.

    • #64676
      garry r fisher
      Participant

      Thanks for those.

      I spent quite a while trying to do these in both regsub and string map without success so I though it best to shout help.

      This is what I like about the Cloverleaf community.

      Thanks again.

      Garry

    • #64677

      Kevin Kinnell wrote:

      Or (as Charlie would point out except I beat him to the punch, nyah!)

      you could use

         string map {{“} {}} $filenamestring

      –kk

      I was totally trying to beat Charlie to it, too, but I could not for the life of me figure out how to make it work with string map.  ðŸ˜¯ Nested bracers! Never would have thought of that.

      Maybe a prettier way with regsub could be like this:

      Code:

      regsub -all {”} $data {} data

      -- Max Drown (Infor)

Viewing 4 reply threads
  • The forum ‘General’ is closed to new topics and replies.

Forum Statistics

Registered Users
5,117
Forums
28
Topics
9,292
Replies
34,432
Topic Tags
286
Empty Topic Tags
10