/**
 * @author Renaud
 */
String.prototype.ltrim = function()
{
	return this.replace(/^\s+/, '');
};

String.prototype.rtrim = function()
{
	return this.replace(/\s+$/, '');
};

String.prototype.trim = function()
{
	return this.ltrim().rtrim();
};

String.prototype.toFloat = function()
{
	return parseFloat(this.replace(',', '.').replace(/[^0-9\.-]/g, ''));
};

String.prototype.toInt = function()
{
	return parseInt(this.replace(/[^0-9\.,-]/g, ''));
};

String.prototype.nl2br = function()
{
	return this.replace(/\n/g, '<br />');
};

String.prototype.br2nl = function()
{
	return this.replace(/<br( \/)?>/g, "\n");
};
