Split unstructured data

Hi all, how can I split unstructured data in a text file by each line? Eg Below:

Text file data:

Hi all,

I am a text file

Regards,
Text file


End of text file


What I need to do is just split it by line and add the | delimit between the lines like the below:
Hi all,|I am a text file|Regards,|Text file

@rohangroombridge

After splitting the text based NewLine as delimiter then use String Join function to join the strings.

  1. First use Read Text file activity to read the text and assign it to one string variable and say ‘textData’. And then split it based on New line.

      textArray [] = textData.Split(Environment.NewLine.TocharArray)
    

And then use join Function.

    requiredStr = String.Join("|", textArray)
1 Like

@rohangroombridge,

try with this,

String.Join("|", strInput.Split({Environment.NewLine}, StringSplitOptions.None))

hi @rohangroombridge

use replace activity to replace New line with | like below

str1 = inputstring.replace(vblf,“|”)

or

image

regards
Ajay