code: function simplifyString(s) {
  	let output = '';
  	let previousWhite = false;
  	for (let i = 0; i < s.length; i++) {
  		let c = s[i];
  		let isWhite = isWhiteSpace(c);
  		if (previousWhite && isWhite) {
  			// skip
  		} else {
  			output += c;
  		}
  		previousWhite = isWhite;
  	}
  
  	while (output.length && isWhiteSpace(output[0])) output = output.substr(1);
  	while (output.length && isWhiteSpace(output[output.length - 1])) output = output.substr(0, output.length - 1);
  
  	return output;
  }
docs: Like QString::simpified(), except that it preserves non-breaking spaces (which Evernote uses for identation, etc.)