Newbie Questions: How to remove the leading zeros in tcl

Clovertech Forums Read Only Archives Cloverleaf Tcl Library Newbie Questions: How to remove the leading zeros in tcl

  • Creator
    Topic
  • #50716
    Shu Chen
    Participant

      Hi guys,

      I would like to remove MRN leading zeros. sometimes there are 1 zero and sometimes there are 3 or 4.. which function should i use to to remove the leading zeros? any suggestions? thanks!!!

      PID|0001||0130447||

      PID|0001||0008537||

    Viewing 0 reply threads
    • Author
      Replies
      • #67226
        garry r fisher
        Participant

          Hi,

          Use the string trim commands or more specifically trimleft

          set iData 0001234

          set oData [string trimleft $iData 0]

          returns 1234

          Regards

          Garry

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