Detecting if the row include Environment.Newline or what

Hello,
I need to help for detecting if row contains newline or not.
Is there any way to detect that?
Any help will be apperciated.

YourText.Contains(Environment.Newline)

Did you try this?

in case of Excel line breaks we check with vbLf
for a dynamic search in all cols give a try on

row.ItemArray.Any(Function (x) x.toString.Contains(vbLf))

Dear Basak Demirel,
There are many ways to check and it depends on the content of the string.You can try below (Assuming strTest as the string variable):
strTest.Contains(vbCr)
strTest.Contains(vbCrLf)
strTest.Contains(Environment.NewLine)

Else you can use Regex to get the matches and replace
strTest= Regex.Replace(strTest, “\t|\n|\r”, “”)

2 Likes

Thank you so much

1 Like

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