Loading ...
Sorry, an error occurred while loading the content.

Re: [Clip] Changing case using a Replace

Expand Messages
  • Don Daugherty
    ... Definitely a TYPO ... See if this is what you mean: ^!SetDebug On ^!SetArray %SetA%= A ; B ; C ; D ; Etc. ^!SetArray %SetB%= a ; b ; c ; d ; etc. ^!Info
    Message 1 of 12 , Mar 3, 2010
      On 3/2/2010 4:36 PM, John Shotsky wrote:
      > Thanks, Don.
      > I assume the colon is just a typo.
      Definitely a TYPO
      > How would the array version look? If I wanted to lower case a letter in that
      > same position, would the array permit using two sets of characters, and
      > choosing which one was to be used at run time? I'm envisioning storing two
      > sets of characters in two variables, and setting the appropriate variable
      > active at run time. %U2L% and %L2U%, for example.
      See if this is what you mean:
      ^!SetDebug On
      ^!SetArray %SetA%="A";"B";"C";"D";"Etc."
      ^!SetArray %SetB%="a";"b";"c";"d";"etc."
      ^!Info SetA=^%SetA%^%NL%SetB=^%SetB%^%NL%
      ; A long line begins
      ^!Set %Choice%=^?{(T=C)Select Look4-Change2 choice==_"1: Look4 ^%SetA%,
      ChangeTo ^%SetB%"|"2: Look4 ^%SetB%, Change2 ^%SetA%"}
      ; The long line ends; in email it looks like two!
      ^!Set %Choice%=^$StrCopyLeft("^%Choice%";1)$
      ^!Info Choice=^%Choice%
      ^!If ^%Choice%=1 ^!SetArray %LookFor%=^%SetA%; %ChangeTo%=^%SetB%
      ^!If ^%Choice%=2 ^!SetArray %LookFor%=^%SetB%; %ChangeTo%=^%SetA%
      ^!Set %N%=0
      ^!Inc %N%
      ^!Replace "<I>\K^%LookFor^%N%%" >> "^%ChangeTo^%N%%" RWAS
      ^!If ^%N%<^%LookFor0% NextCase

      Note: The long line broken by email wouldn't be very user friendly in
      the practical case involving 26 values; ^%SetA% and ^%SetB% would have
      to be changed to the words SetA and SetB and you would have to
      remember, from the previous Info display, what they represent.when you
      make your choice.
    Your message has been successfully submitted and would be delivered to recipients shortly.