insert character in string at certain position

Clovertech Forums Read Only Archives Cloverleaf Cloverleaf insert character in string at certain position

  • Creator
    Topic
  • #50669
    Michael Stankov
    Participant

      Hi,

      I have a string in var1 = 38000E9NK02 and want to insert a dot (.) after position 4 = 3800.0E9NK02

      Thanks in advance.

    Viewing 1 reply thread
    • Author
      Replies
      • #67044
        Keith McLeod
        Participant

          Yu might try something like:

          set x “38000E9NK02”

          regsub — {(.{4})(.*)} $x {1.2} y

          echo $y

          3800.0E9NK02

        • #67045
          Michael Stankov
          Participant

            It worked perfectly…thanks a lot!! 😀

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