Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- myString := "S523.WW.E.SIMA"
- ; 1) Split it into the dot-separated parts,
- ; then join it again excluding the last part
- parts := StrSplit(myString, ".")
- newString := ""
- Loop % parts.MaxIndex() - 1
- {
- if(StrLen(newString)) {
- newString .= "."
- }
- newString .= parts[A_Index]
- }
- msgbox % newString
- ; 2) RegExMatch to extract everything up until the last dot
- RegExMatch(myString, "(.*)\.", newString)
- msgbox % newString1
- ; 3) RegExReplace to remove everything, starting with the last dot
- newString := RegExReplace(myString, "\.[^\.]+$", "")
- msgbox % newString
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement