Replacing Escape Characters

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Replacing Escape Characters

Viewing 5 reply threads
  • Author
    Replies
    • #68989

      Here’s a quick test I put together that seems to work:

      Code:

      set var “\.br\\.br\”
      regsub {\.br\\.br\} $var ” ” result
      puts “[$result]”

      set var “\.br\”
      regsub {\.br\} $var “” result
      puts “[$result]”

      -- Max Drown (Infor)

    • #68990

      Here’s a similar discussion: http://clovertech.infor.com/viewtopic.php?t=3332&highlight=escape

      -- Max Drown (Infor)

    • #68991
      Jim Kosloskey
      Participant

      David,

      Try treating xlateInVals and xlateOutVals as lists.

      Once you get the list element you want from xlateInVals I think your logic will work fine.

      Just be sure to build xlateOutVals as a list.

      email: jim.kosloskey@jim-kosloskey.com 29+ years Cloverleaf, 59 years IT - old fart.

    • #68992

      Just in case, what Jim means is something like “set var [lindex $xlateInVals 0]” and “set xlateOutVals

        “.

      -- Max Drown (Infor)

    • #68993
      Charlie Bursell
      Participant

      set $xlateOutVals $xlateInVals is superflous since, by default, xlateOutVals *IS* equal xlateInVals.

      The statement:  if {$result >=0} {

      will always be true since the rexexp above will return 0 or 1

      As Jim said, treating xlateInVals and xlateOutVals as lists will probably solve your problem.

      FWIW, I like string map in this situation bettter than regsub becaulse of the backslashes and the dots.  However opinions are like rear ends.  We all have one and most of them stink  ðŸ˜†

    • #68994
      David Harrison
      Participant

      Many thanks to all. I followed Jim’s advice and it worked perfectly.

      Charlie, from what you say, I presume you value Dolly Parton’s opinion.

      Regards,

      Dave

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

Forum Statistics

Registered Users
5,126
Forums
28
Topics
9,297
Replies
34,440
Topic Tags
287
Empty Topic Tags
10