
String.prototype.trim    = function () { return (this.replace (/^\s*|\s*$/g, '')); }




String.prototype.asFloat = function ()
{
	var Numero = /^-?\d*[\.,]?\d*$/;
	var Aux    = this.trim ();

	if (Numero.test (Aux))
	{	if (Aux) return parseFloat (Aux.replace (',', '.'));
		return (0);
	}
	return NaN;
}


String.prototype.asInteger = function ()
{
	var Aux = this;
	
	while (Aux.charAt (0) == '0') Aux = Aux.substr (1);
	Aux = parseInt (Aux);
	if (isNaN (Aux)) return 0;
	return Aux;
}


Number.prototype.round = function (decimales) { return Math.round (this * Math.pow (10, decimales)) / Math.pow (10, decimales); }

