Displaying characters after delimiter

Easiest way to ask this is an example. The user would enter a full name (first/last, given/family…) into a text field. In another text field I’d like to display everything after the space. So “John Smith” would show “Smith” in the second field. “Alexander Roberts” would display “Roberts” in the second field. I’m happy to skip on names with multiple spaces like “Mary Lou Jones” since this is just for demo purposes (unless it’s really easy…)

I’ve got it working well enough to demo what I want to do using [[getlast.substring(5)]] and making sure that the first name is four characters long. I also tried [[getlast.split(’ ')]] and it splits with commas but I don’t know how to grab the last item in the “array”.

But just to make it a bit more robust (and for, you know, learning) is there a straightforward way to do this?

Assuming the getlast variable is the text on the first input field:

[[getlast.slice(getlast.lastIndexOf(' ') + 1)]]


That works perfectly. Thanks heaps.