When a user fill out my form to create a new Person, I'd like there to be no whitespace before or after a name (type String
).
Good
: "John Doe"
Bad
: "John Doe " or " John Doe"
Looking at this SO post, it seems that I want to use a custom ModelBinder. However, as I perhaps incorrectly understand the post, replacing my DefaultModelBinder will mean that all strings will not be allowed to have leading or trailing whitespace.
How can I ensure that only Name
's are affected by this custom ModelBinder?