trim string value before transform it in a primitive

Try not to reorganise imports (especially when no other changes) - previous was the Eclipse defaults; I believe this is the IntelliJ defaults.