Replacing & in text results

Homepage Clovertech Forums Read Only Archives Cloverleaf Cloverleaf Replacing & in text results

  • Creator
    Topic
  • #49219
    Gary Linden
    Participant

    Hello all – I’ve had a request from our Lab system to scan the text results they send us and replace any ‘&’ with a ‘+’.  I know I’ve seen references to code to do this here in the past but have been unable to locate the specific messages.  Can someone point me in the right direction?

    Thanks,

    Gary

Viewing 2 reply threads
  • Author
    Replies
    • #61141
      Elizabeth Wilson
      Participant

      Insert the part of this code that pertains to your needs into tps proc, change the variable to ‘+’:

      keylget args MSGID mh

                set msg [msgget $mh]

          # Set up variables to be used as a substitute for unwanted characters

              # Epic is set to convert the variables back to its originals

              # in OBX text lines

                  set char1 “\E\”

                  set char2 “\S\”

                  set char3 “\R\”

                  set char4 “\T\”

              # split msg into two variables to take out &’s from

              # message but preserve it in the encoding characters

                set string1 [string range $msg 0 8]

                set string2 [string range $msg 9 end]

       

                if { [string match *|* $string2] ||

                     [string match *^* $string2] ||

                     [string match ** $string2] ||

                     [string match *\* $string2] ||

                     [string match *&* $string2] ||

                     [string match *~* $string2] ||

                     [string match *””* $string2] ||

                     [string match *”* $string2]  } {

                     regsub -all {\} $string2 $char1 string2

                     regsub -all {\\} $string2 {} string2            

                     regsub -all {|} $string2 {} string2

                     regsub -all {^} $string2 $char2 string2

                     regsub -all {~} $string2 $char3 string2

                     regsub -all {&} $string2 $char4 string2

                     regsub -all {“} $string2 {} string2

                     regsub -all {“”} $string2 {} string2

                   # reconstruct message by joining both parts

                   

                     set msg $string1$string2

                }

    • #61142
      Gary Linden
      Participant

      Thanks Elizabeth, I’ll give it a try.  Appreciate the quick response.

      Gary

    • #61143
      Russ Ross
      Participant

      Check out my post of

      tps_regsub_all.tcl

      at URL

      http://clovertech.infor.com/viewtopic.php?t=1663” class=”bbcode_url”>http://clovertech.infor.com/viewtopic.php?t=1663

      Russ Ross
      RussRoss318@gmail.com

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

Forum Statistics

Registered Users
5,115
Forums
28
Topics
9,290
Replies
34,422
Topic Tags
286
Empty Topic Tags
10