I have to remove ".1.3" from the string.

Jouher_20929
Jouher_20929 Altair Community Member
edited October 2020 in Community Q&A

'hello.A  at  strain rate:=1000.235 per milli-second.1.3' Consider this string. I have to remove '.1.3' from last word of string and give whole string back. It should be generic. That is, from last word i have to remove every characters after '.' [including '.']

Answers

  • tinh
    tinh Altair Community Member
    edited October 2018

    Hi,

    if the last word of STR is 'second' :

    set STR [string range $STR 0 [string last second $STR]+5]

     

    or 

    regsub second.* $STR second STR