Implement client/server Util.trim