Skip to content

Latest commit

 

History

History
22 lines (22 loc) · 725 Bytes

insert spaces.md

File metadata and controls

22 lines (22 loc) · 725 Bytes
function space(){
	var len = document.getElementById('text').value.length;
	var text = document.getElementById('text').value;
	var text2 = text.charAt(0);
	for(var i = 1; i < len-1; i++) {
	text2 += text.charAt(i);
	if(text.charCodeAt(i) > 128 && text.charAt(i+1) != " " && text.charAt(i+1) != "\n")
	text2 += " ";
        }
		text2 += text.charAt(len-1);
		len = text2.length;
		var text3 = text2.charAt(0);
        for(var i = 1; i < len-1; i++) {
            if(text2.charCodeAt(i) > 128 && text2.charAt(i-1) != " " && text2.charAt(i-1) != "\n")
				text3 += " ";
            text3 += text2.charAt(i);
        }
		text3 += text2.charAt(len-1);
        document.getElementById("text").value = text3;
    }