Hello Ingemar,
Yes, there is. You can configure a Business Rule triggered before creating a user that will trim the extra spaces. For information on how to create such a rule, see the following tutorial: http://www.adaxes.com/tutorials_Simplif ... Script.htm.
On Step 5 of the tutorial, use the following PowerShell script:
# Get the Display Name
$displayName = $Context.GetModifiedPropertyValue("displayName")
# Trim extra spaces
$displayName = $displayName.Trim()
# Save changes
$Context.SetModifiedPropertyValue("displayName", $displayName)