- Rock Content Knowledge Base
- Ion
- Tips and Tricks
Scriptlet: Trim Spaces
Prior to data export, you can trim any leading or trailing spaces from a field by saving a scriptlet result with advanced rules or by leveraging a JavaScript field in the export format.
// return data collection value after trimming leading/trailing spaces
var trimField = respondent.dataname.replace(/^\s+|\s+$/g, "");
return trimField;
If you have any questions, please contact us on help@rockcontent.com. 😀