Remove Last Character Each Row from Read Text

Hi, good day,

I have a text file contains


how can I remove the last character “|” of each row?

Im using generate data table with | as column separator but it still recognize the last character as another column.

Thank you.


Try this:




thanks for response. it is text file so it does not contain any column. i already try Length-1 and Remove with LastIndexOf, not working…it only remove the last row only


Oh ok. I thought it is from Excel file.

Use Read Text file activity to read the text and will give you output as string and store it in a variable if type string and say ‘readText’. And then use following expression:


And same way do for all lines.

1 Like

Hello @chakri for one liner code you can use below as well…

String.join(Environment.NewLine,(from x in str.Split(Environment.NewLine.ToCharArray,StringSplitOptions.RemoveEmptyEntries).ToList select y =Left(x.ToString,x.ToString.Length-1)))

1 Like

Hi @chakri
Please find the Attachment it will help (13.2 KB)

1 Like

Hi all,

thanks for wonderful reply. all solution replied working out well. for anyone see this question, you can download attached workflow from @jitendra_123 .

Thank you and appreciate it !

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