strip leading/trailing white space and following inline comments from value

strip leading/trailing white space and following inline comments (if separated by at least a space or a tab) from value.