Return to Snippet

Revision: 6521
at May 27, 2008 05:41 by Meestercor


Initial Code
function autoFormat(what:String, numSpaces:Number):String {
	var tmp:Array = what.split(".");
	if (!numSpaces) {
		numSpaces = 1;
	}
	var tmpStr:String = "";
	for (var i:Number = numSpaces; i>0; i--) {
		tmpStr += " ";
	}
	for (var i in tmp) {
		while (tmp[i].charAt(0) === " ") {
			tmp[i] = tmp[i].slice(1, tmp[i].length);
		}
		tmp[i] = tmp[i].charAt(0).toUpperCase()+tmp[i].slice(1, tmp[i].length);
	}
	
	return tmp.join("."+tmpStr).split(" i ").join(" I ").split(" i'").join(" I'");
}

Initial URL


Initial Description


Initial Title
Autoformat text

Initial Tags
textmate, text

Initial Language
Other