Xwiki velocity trim() method

For example

$xcontext.user → Xwiki.user.trim(‘Xwiki’)

“XWiki.” How can I remove the expression?
I tried this but it did not work.

You need to do:
$xcontext.userReference.name

thanks @gdelhumeau

How do I get a user’s first and last name like this?
I tried:

$xcontext.userReference.firstname
$xcontext.userReference.first_name

but did not work

You may want to read https://www.xwiki.org/xwiki/bin/view/Documentation/DevGuide/Scripting/XWikiVelocityTraining/

It’s a bit old but still quite relevant.