ChuckP Absent Member.
Absent Member.
455 views

Convert line by line list to comma delimted list

Jump to solution

I have a flow variable that contains something like:

AAA

BBB

CCC

(Since this came from stdout on a UNIX machine I'm assuming the new line character (\n) is a line feed (0A hex).

I want to create a comma separated list like:

AAA,BBB,CCC

I have tried various results filters and can't get the job done.  I tried just appending a comma to the end of each line but invisible new line characters still appear to exist.  Any suggestions?  Thanks!

 

 

Labels (1)
0 Likes
1 Solution

Accepted Solutions
Super Contributor.. Chuck Perilli Super Contributor..
Super Contributor..

Re: Convert line by line list to comma delimted list

Jump to solution

 Figured it out.  My fix is this simple scriptlet:

strCSV = scriptletInput.replace(/(\r\n|\n|\r)/gm,",");
scriptletResult = strCSV

 

 

1 Reply
Super Contributor.. Chuck Perilli Super Contributor..
Super Contributor..

Re: Convert line by line list to comma delimted list

Jump to solution

 Figured it out.  My fix is this simple scriptlet:

strCSV = scriptletInput.replace(/(\r\n|\n|\r)/gm,",");
scriptletResult = strCSV

 

 

The opinions expressed above are the personal opinions of the authors, not of Micro Focus. By using this site, you accept the Terms of Use and Rules of Participation. Certain versions of content ("Material") accessible here may contain branding from Hewlett-Packard Company (now HP Inc.) and Hewlett Packard Enterprise Company. As of September 1, 2017, the Material is now offered by Micro Focus, a separately owned and operated company. Any reference to the HP and Hewlett Packard Enterprise/HPE marks is historical in nature, and the HP and Hewlett Packard Enterprise/HPE marks are the property of their respective owners.