Ubuntu - xargs - Trim blank spaces from a String

Just pipe the string to the xargs command.

echo "     Hello world!    " | xargs

returns:

Hello world!