Removing trailing character(s): Is there a way to remove a particular character, or several characters, at the end of a GuiXT variable?

There is no special command for doing this, but you can use the following coding. 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".


// We set a particular value for testing

Set V[x] "a @ b c d e @@@"

// byte that we want to delete at the end

Set V[trim] "@"

// delete trailing bytes

// string length (in bytes)

Set V[i] "&V[x]"  -stringlength

label trim

 if V[i=0]

   goto trim_end


 // last byte

 Set V[c] &V[x](&V[i]-&V[i])

 if not V[c=&V[trim]]

   goto trim_end



 // remove 1 character

 Set V[i] &V[i] - 1

 if V[i=0]

   Set V[x] ""

   goto trim_end


 Set V[x] "&V[x](1-&V[i])"

 goto trim


label trim_end

// test output

Title ">>>&V[x]<<<"