Added trimming functions

This commit is contained in:
Dennis Eichhorn 2017-05-31 10:33:12 +02:00 committed by GitHub
parent 278c35d7d2
commit 16f9050121

View File

@ -8,6 +8,21 @@
(function (jsOMS)
{
"use strict";
jsOMS.trim = function(str, char)
{
return jsOMS.ltrim(jsOMS.rtrim(str, char), char);
};
jsOMS.rtrim = function(str, char)
{
return str.replace(new RegExp("[" + char + "]*$"), '');
};
jsOMS.ltrim = function(str, char)
{
return str.replace(new RegExp("^[" + char + "]*"), '');
};
/**
* Class finder