Replace Alt+Enter from cell Value with space

Hello All ,

I need to replace Alt+Enter with space in a column name.
I tried to replace like this : item.ToString.Replace(Environment.NewLine," ")
But its not working. This is what the cell looks like :

image

Can anybody please help me with this.

Regards,
Akanksha

item = item.tostring.Replace(”\n", “”).Trim()

Hello @BjarteIversen ,

Thanks for the reply. I have tried with \n as well but that is also not working.

Hi @pakankshabha

system.Text.RegularExpressions.Regex.Replace(yourStringVariable,"\n"," ")

If it is resolved your problem . Please mark as solution

Thanks,
Amaresan. P

Hi @pakankshabha

Are you sure there is a linefeed in the string or is it a gui breaking the string because of the column width?

Try printing the result of the replace statement to console to be sure.
/B

Hello All ,

Thanks for the responses. I tried with item.ToString.Replace(Chr(10)," ")
This solution worked for me.

1 Like