Or, if you're not sure what's in the string, safer to say str = (str == null) ? null : str.Trim();
As an aside, I very rarely use Trim() because almost invariably what I want to do isn't simply trim a string, but do something more akin to XPath's normalize_space() function: remove all leading and trailing whitespace AND replace each whitespace block inside the string with a single space. Trim() without the extra normalize_space feature always strikes me as a bit limited in usefulness. =================================== This list is hosted by DevelopMentorĀ® http://www.develop.com View archives and manage your subscription(s) at http://discuss.develop.com