Purpose
Remove trailing characters

Please keep in mind that this is not necessary for space characters, since they are truncated automatically when you use a GuiXT variable unless you have specified
ProcessingOption trailingSpace="On"

Solution

// sample value
Set V[city] "@@@@@München@@@"

// character to remove
Set V[trimchar] "@"

// length of string in characters
Set V[k] "&V[city]" -charCount

// search last non-matching character
label compare
if V[k>0] and V[trimchar=&V[city](&V[k],&V[k])]
  Set V[k] &V[k] - 1
  goto compare
endif

// set new string
Set V[city2] "&V[city](1,&V[k])"

// test message
Message
"&V[city]\n&V[city2]"

Components
InputAssistant