- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2019 08:10 PM
Hi - I want to convert below lines to single line. Is this something possible with JavaScript?
This is line one
This is line two
This is a broken line
This is line three
Expected output:
This is line one, This is line two This is a broken line, This is line three
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2019 08:31 PM
Try this out
var line = '';
var lines = multiLines.split("\n"); //multiLines contains your text
for(var i=0; i<lines.length; i++){
if(lines[i].startsWith(" ")){
line += " " + lines[i].trim();
}else{
line += "," + lines[i].trim();
}
}
line = line.substring(1).trim();
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2019 08:16 PM
Hi,
Can you try this script.
var line = '';
var lines = multiLines.split("\n"); //multiLines contains your text
for(var i=0; i<lines.length; i++){
line += "," + lines[i].trim();
}
line = line.substring(1);
gs.info(line);
Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-19-2020 02:41 AM
Hi Mate,
I am stuck to a very strange problem and need your assistance. How to Compare between String Field and Multi Line Text Variable. I have a multi line text variable "ci_desc" and there is a CI short Description field "short_description".
There is a CI record having data like
Short Description : Enterprise Resource Planning - Commercial ERP
ERP in Russian
I can read those values properly but trying to check whether the values are equal or not. Inspite of they are being equal I am getting not matching alert. Please help.
Code Snippet:
if(gr1.short_description.replace(/\r?\n|\r/g, "") == ee.toString())
{
gs.log("match got");
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2019 08:21 PM
Thanks for the reply. This is working for me. Can I do something like below?
This is line one
This is line two
This is a broken line
This is line three
Expected output:
This is line one, This is line two This is a broken line, This is line three
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-17-2019 08:31 PM
Try this out
var line = '';
var lines = multiLines.split("\n"); //multiLines contains your text
for(var i=0; i<lines.length; i++){
if(lines[i].startsWith(" ")){
line += " " + lines[i].trim();
}else{
line += "," + lines[i].trim();
}
}
line = line.substring(1).trim();