Optionally throws exception on null and empty string.