Skip to content

underblob

<アンダブロッブ />

Javascript Encode HTML Entities

var htmlEntities = function(str) {
	return str.replace(/[\u00A0-\u99999<>\&]/gim, function(i) {
		return '&#'+i.charCodeAt(0)+';';
	});
};

Links

Stack Overflow

Author underblobPosted on 2014.01.142014.01.14Categories TechTags code, Javascript

Post navigation

Previous Previous post: Replace All Occurrences in a String
Next Next post: Seed Leaf
underblob Proudly powered by WordPress