//------------------------------------------------------------------------------------ // DESCRIPCION: En una cadena de texto sustituye la primera subcadena por la segunda. // ENTRADAS: -> inputString: cadena de texto donde se va a reemplezar. // -> badString: subcadena a sustituir. // -> goodString: subcadena de texto correcta. // SALIDAS: Cadena de texto modificada // AUTOR: --- //------------------------------------------------------------------------------------ function replaceSubstring ( inputString, badString, goodString){ // IE & NS6 fixedReplace = ""; UI = inputString; UB = badString; badEnd = -1; badLoc = UI.indexOf(UB); if (badLoc != -1) { for (x=1; (badLoc != -1);x++) { fixedReplace = fixedReplace + inputString.substring((badEnd + 1), badLoc) + goodString; badEnd = badLoc + UB.length - 1; badLoc = UI.indexOf(UB, (badLoc + 1)); } fixedReplace = fixedReplace + inputString.substring((badEnd+1),inputString.length); } else { fixedReplace = inputString; } return fixedReplace; } //------------------------------------------------------------------------------------ // DESCRIPCION: Comprueba si una cadena es numérica. // ENTRADAS: -> str: cadena de texto a comprobar. // SALIDAS: True si es numérico False si no lo es. // AUTOR: --- //------------------------------------------------------------------------------------ function IsNum(str){ // IE & NS6 var num = True; var i = 0; while ((i"9") { num = False; } i++; } return(num); } //------------------------------------------------------------------------------------ // DESCRIPCION: Elimina los caracteres en blanco no significativos. // ENTRADAS: -> inputString: cadena de texto para eliminar blancos. // SALIDAS: Cadena de texto. // AUTOR: --- //------------------------------------------------------------------------------------ function Trim(inputString){ // IE & NS6 fixedTrim = ""; lastCh = " "; for(x =0; x < inputString.length; x++) { ch = inputString.charAt(x); if ((ch != " ") || (lastCh != " ")) { fixedTrim += ch; } lastCh = ch; } if (fixedTrim.charAt(fixedTrim.length - 1) == " ") { fixedTrim = fixedTrim.substring(0, fixedTrim.length - 1); } return fixedTrim; } // Fin función trim //------------------------------------------------------------------------------------ // DESCRIPCION: Traduce una cadena de texto a Unicode. // ENTRADAS: -> inputString: cadena de texto para eliminar blancos. // SALIDAS: Cadena de texto. // AUTOR: --- //------------------------------------------------------------------------------------ function String2Unicode(inputString){ // IE & NS6 var salida=""; for( i=0 ; i,.?/1234567890"; fixedProperCase = ""; twoPast = " "; lastChar = " "; for (place=0; place < inputstring.length; place++) { char1 = u.charAt(place); if (specialChars.indexOf(lastChar) != -1) { if ((lastChar == "\'") && (twoPast != "D")) { char1 = char1.toLowerCase(); } } else { char1 = char1.toLowerCase(); } fixedProperCase += char1; twoPast = lastChar; lastChar = char1; } fixedProperCase = Trim(fixedProperCase); return fixedProperCase; }