// retorna true se o primeiro caracter do String for uma letra function isLetter (c) { var l = c.charAt(0); return ( ((l >= "a") && (l <= "z")) || ((l >= "A") && (l <= "Z")) ) } // Retorna True se no String tem caracteres nao alfabeticos // (adaptado por Tania/22/2/2002) function lettersOnly(s) { var temCharInv = true; for (var i = 0; i < s.length; i++) { var c = s.charAt(i); if ((c == " ") || isLetter(c)) temCharInv = true; else {temCharInv = false; break;} } return(temCharInv); } // retorna true se string for branco function isSpace(s) { return(AllTrim(s) == ""); } // retorna true se caracter tem acento function isLetterAc (c) { var acentos = new String("çáéíóúàèìòùâêîôûãõäëïöüÿýÇÁÉÍÓÚÀÈÌÒÙÂÊÎÔÛÃÕÄËÏÖÜŸÝ"); return (acentos.indexOf(c) != -1) } // retorna string sem os brancos da esquerda function LTrim(texto) { fim = false; while(!fim) { caracter = texto.substr(0,1); if(caracter == " ") texto = texto.substr(1); else fim = true; } return texto; } // retorna string sem os brancos da direita function RTrim(texto) { fim = false; while (!fim) { caracter = texto.substr(texto.length - 1); if(caracter == " ") texto = texto.substr(0,texto.length - 1); else fim = true; } return texto; } // retorna string sem os brancos da direita e da esquerda function AllTrim(texto) { return RTrim(LTrim(texto)); } function tiraZeroBrancos (text) { text = AllTrim(text); if (text == "0") text = ""; return text; }