summaryrefslogtreecommitdiffstats
path: root/admin/ogAdmSources/ogAdmWebCon/jscripts/cadenas.js
blob: 83e377a274b383cc06b135492d2fb9b62e687168 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// *************************************************************************************************************************************************
//	Libreria de scripts de Javascript
// Autor: José Manuel Alonso (E.T.S.I.I.) Universidad de Sevilla
// Fecha Creación:2003-2004
// Fecha Última modificación: Noviembre-2005
// Nombre del fichero: cadenas.js
// Descripción : 
//		Este fichero implementa funciones de uso común para cadenas
// *************************************************************************************************************************************************
function TrimLeft( str ) {
	var resultStr = "";
	var i = len = 0;
	if (str+"" == "undefined" || str == null) 	return null;
	str += "";
	if (str.length == 0) 
		resultStr = "";
	else { 
		len = str.length;
		while ((i <= len) && (str.charAt(i) == " "))	i++;
		resultStr = str.substring(i, len);
	}
	return resultStr;
}
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function TrimRight( str ) {
	var resultStr = "";
	var i = 0;
	if (str+"" == "undefined" || str == null) 	return null;
	str += "";
	if (str.length == 0) 
		resultStr = "";
	else {
		i = str.length - 1;
		while ((i >= 0) && (str.charAt(i) == " "))	i--;
		resultStr = str.substring(0, i + 1);
	}
	return resultStr; 
	}
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
function Trim( str ) {
	var resultStr = "";
	resultStr = TrimLeft(str);
	resultStr = TrimRight(resultStr);
	return resultStr;
}