Output datatable to string>> how to chang separator for row

Hi All,

Using activity Output Data Table i m converting from DataTable into String
Then I want to let’s say have the results in the Message Box.
every row is in new line, and I want to have in one line
The question is how to have a result with “-” but not with New Line
I used below in Assign, but don’t work:

System.Text.RegularExpressions.Regex.Replace( strResult,“\n”,“-”)
strResult.Replace(vbCrlf,“-”)
strResult.Replace(vbNewLine,“-”)

Hi @Amee.hajimohammadi,

Welcome to community.

Can you share the output of output datatable?

Regards,
MY

I haven’t tested it but this might work

strResult.Replace(Environment.newline, "-")

Hi
image

You can use this line,

result.Replace(Environment.NewLine(),“-”)

If it’s not a very large datatable, it can also be done with a for loop.

I hope it works for you

Regards,
MY

without foreach it does not work, and I also dont want to use foreach

no it does not work

Hi,

Can you try the following expression?

System.Text.RegularExpressions.Regex.Replace(strResult,"\r?\n","-")

Regards,

1 Like