Removing of empty lines from Text file or Variable?

I have a variable containing some data and stored it into one note pad and i will get some empty lines, that lines may be single or double or triple. I need to delete those lines from the variable before store it to note pad or after storing it into note pad. I will attached the sample note pad file.
Data.txt (99 Bytes)

Please any one help me… Thank You…

we assume a string variable - strText

Assign Activity
strClean =

String.Join(Environment.NewLine, strText.Split({Environment.NewLine}, StringSplitOptions.RemoveEmptyEntries))

Write Text File Activity - using strClean

grafik

Hi,

FYI, another approach:

image

System.Text.RegularExpressions.Regex.Replace(strData,"(\r\n){2,}",vbCrLf)

Regards,

Hello @vanithavs , Kindly try this Regex replace Expression

System.Text.RegularExpressions.Regex.Replace(YourString,"\s+{2, }","").ToString

image

image

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.