Replace new Line with space

Hi,

I have this value

Reason for Leaving
Job search for a full time job in the bank while taking a ABC
PAPERS

I want this in single line so I used replace funtion to replace newline with space using vbnewline, System.Environment.newline , vblf but nothings working

Please suggest a solution if anyone has :slight_smile:

Hi @shreyaR

Try this

String.Join(" " ,Split(input,Environment.NewLine))

where input is the string provided as input

Hope it helps you

Mark it as solution if it resolves your query

Regards
Nived N

Happy Automation

Any of these should be work:

Assign:

value = value.Replace(Environment.NewLine, " ")
OR
value = value.Replace(vbCrlf, " ")
OR
value value.Replace(vbNewLine, " ")

If none of them work, write your content to a text file and open it on NotePad++. There, go to “View > Show Symbol > Show All Characters” and confirm that what you see is:

image

Maybe another symbol is causing the issue.

I didn’t solve the issue :frowning:

It works for me fine

What error u are facing?

Use this below code, @shreyaR
System.Text.RegularExpressions.Regex.Replace( InputValue.Trim,"\n"," ")

Hope this may help you :slight_smile:

2 Likes

thank you very much