Built-in Function for removing leading and trailing spaces

Does SenseTalk happen to have any built-in function to remove leading and trailing spaces in a string? If not, i guess i will have to write my own then :frowning:

It’s not as neat as a “trim” command, but you can say:

put words first to last of myString into myString

This range describes everything between the beginning of the first word (the first non-whitespace character) and the end of the last word, including any whitespace that falls in that range. You could always turn this into a trim script. You can cut and paste the example below to get a better feel for how this works:

put "   this is some text with     extra white space    " into myString
put myString
put words first to last of myString into myString
put myString & "<-- extra spaces removed"

I hope this will work for your purposes.