/ Published in: Other
                    
                                        
                            
                                Expand |
                                Embed | Plain Text
                            
                        
                        Copy this code and paste it in your HTML
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'");
}
Comments
 Subscribe to comments
                    Subscribe to comments
                
                