diff options
author | alonso <alonso@us.es> | 2010-10-23 09:34:04 +0000 |
---|---|---|
committer | alonso <alonso@us.es> | 2010-10-23 09:34:04 +0000 |
commit | 3ec149cb19165453434984c88e8ba03f648e578e (patch) | |
tree | 9d315751684c2c27ed66ad645aeea52ce9027859 /admin/WebConsole/jscripts/cadenas.js | |
parent | 550b680d176cbccfecfe35fad440dd570d90ba5b (diff) |
git-svn-id: https://opengnsys.es/svn/trunk@1314 a21b9725-9963-47de-94b9-378ad31fedc9
Diffstat (limited to 'admin/WebConsole/jscripts/cadenas.js')
-rw-r--r-- | admin/WebConsole/jscripts/cadenas.js | 45 |
1 files changed, 45 insertions, 0 deletions
diff --git a/admin/WebConsole/jscripts/cadenas.js b/admin/WebConsole/jscripts/cadenas.js new file mode 100644 index 00000000..520631e1 --- /dev/null +++ b/admin/WebConsole/jscripts/cadenas.js @@ -0,0 +1,45 @@ +// ************************************************************************************************************************************************* +// Libreria de scripts de Javascript +// Autor: José Manuel Alonso (E.T.S.I.I.) Universidad de Sevilla +// Fecha Creación: 2009-2010 +// 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; +}
\ No newline at end of file |