Replacing a comma in a list

Clovertech Forums Read Only Archives Cloverleaf Tcl Library Replacing a comma in a list

  • Creator
    Topic
  • #51612
    Manny Zachodin
    Participant

      I have a name of a provider that has a comma in it ” HEALTH HERO NETWORK, INC”.  Is there a sunstitute function in TCL to handle this specific case? I tired to use regsub with no success. I would like to use the function in xlate.  Thank you very much for your help.

    Viewing 1 reply thread
    • Author
      Replies
      • #70981
        Mason Miller
        Participant

          something like this should work

          regsub -all {,} $xlateInVals { } xlateOutVals

        • #70982
          Tom Rioux
          Participant

            One small correction, make sure the empty list notation does not have a space or you will end up with two spaces before the word “INC”

            This should work:  

            regsub -all {,} $xlateInVals {} xlateOutVals

            or the string map would suffice too:

            set xlateOutVals [string map {, {}} $xlateInVals]

            Hope this helps….

            Tom Rioux

        Viewing 1 reply thread
        • The forum ‘Tcl Library’ is closed to new topics and replies.