function Util.TrimString(S)local Q,X=string.find(S,"\094\037\115\042")return X==#S and""or string.match(S,"\046\042\037\083",X+1)end
--- Trims whitespace from both sides of a string.
function Util.TrimString(str)
	local _, from = string.find(str, "^%s*")
	-- trim the string in two steps to prevent quadratic backtracking when no "%S" match is found
	return from == #str and "" or string.match(str, ".*%S", from + 1)
end
