Writer: Insert the first word of the file name in the file?

The file name without extension, is composed of two or three names separated by a space.
In LibreOffice writer, we can insert the name without extension.
How to include only the first name?
For example, should a function like: Subword (name without extension, 1)
and why not: Subword (name without extension, 2)