Search code examples
stringtrim

When is it acceptable to not trim a user input string?


Can someone give me a real-world scenario of a method/function with a string argument which came from user input (e.g. form field, parsed data from file, etc.) where leading or trailing spaces SHOULD NOT have been trimmed?

I can't ever recall such a situation for myself.

EDIT: Mind you, I didn't say trimming any whitespace. I said trimming leading or trailing (only) spaces (or whitespace).


Solution

  • Search string in any "Find" dialog in an editor.