How to replace special characters with new line?

I am new user of UiPath. I am trying to use it to do some file processing but I get stuck when to replace $ with new line.

I use “Read Text File” activity to read the data(aaa$$$bbb) from text file and store into variable. Then I use “Replace” activity with Input as the variable, pattern as “$”, and replacement as “\n”. I am not sure can \n use to create new line.

The result I get is aaa$$$bbb\n
The expected result I want is

Can I know which part of the process had been done wrongly? Thanks

Hello @hytong,

You can use Environment.NewLine

Take a look at this:


@Susana Wow thanks! It’s work for Create New Line. But still cannot replace the dollar sign $, any advice?

I’d try with other special character like @ and it got no problem.

Hello @hytong,

You can use text.Replace("$",Environment.NewLine) or text.Replace(Chr(36),Environment.NewLine)

This works for me:


@Susana Thanks. I’ve try it and I can see the expected result in console. But when I add another “Message box” to show the “text” right after the “Write Line” action done, I am still getting aaa$$$ccc.

Hey @hytong,

Try to use Assign activity


@Susana Yes it solved! Thanks a lot.

But personally I think the “Replace” activity is weird as it can be use for other special character but not $.

How to perform subString operation using IndexOf for “=” character.

item.Substring(item.IndexOf("=")+2) is throwing validation error.

Apologize if this is not the right way to raise a query.

Thanks in advance.