Skip to content

Commit 4f30075

Browse files
authored
Merge pull request #4284 from Countly/SER-730
[SER-730] added function to trim spaces, tabs, and newlines
2 parents ac707e8 + 16f24f5 commit 4f30075

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

frontend/express/public/javascripts/countly/countly.common.js

+10
Original file line numberDiff line numberDiff line change
@@ -5186,6 +5186,16 @@
51865186
}
51875187
return _.unescape(text || df).replace(/'/g, "'");
51885188
};
5189+
5190+
/**
5191+
* Remove spaces, tabs, and newlines from the start and end of the string
5192+
* @param {String} str - Arbitrary string
5193+
* @returns {String} Trimmed string
5194+
*/
5195+
countlyCommon.trimWhitespaceStartEnd = function(str) {
5196+
str = str.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g, '');
5197+
return str;
5198+
};
51895199
};
51905200

51915201
window.CommonConstructor = CommonConstructor;

0 commit comments

Comments
 (0)