Hi, I have a data table where one column has two different options for strings (lines).
A: there will either be one string (line)
B: there will be two strings (where the second is newline)
My issue is this: If there is only one string (line), this needs to be deleted. How can I do that?
Hi @wwls ,
In the Datatable approach, assuming that you have already read the data as a Datatable, we will be able to filter the required rows that contains the New Line character in the below way :
DT = DT.AsEnumerable.Where(Function(x)Regex.IsMatch(x(0).ToString,"\n")).CopyToDataTable
DT is the input datatable,
FilteredDT is a new Datatable and
0 index is used to mark the first column in the datatable.
The above expression would result in an error if there are no rows filtered that matches the condition and hence you could follow the post below on handling that error :