How can we remove line break from a datatable?
Want to compare data among two datatables ,but in one datatable there is a linebreak in data ,Need to remove line break for complete column value example shown below.
Input:
“Less usage of
Material required”
Output:
“Less usage of Material required”
How can I remove line break for whole column using linq query?
lrtetala
(Lakshman Reddy)
September 28, 2023, 10:10am
2
Hi @yashashwini2322
Try this
Input.ReplaceLineEndings(" ")
Hope this helps!!
Try like this
Stroutput = String.Join(“ “, Split(stringinput, Environment.NewLine)).ToString
Hope this helps
Cheers @yashashwini2322
Try like this:
row("Col2") = row("Col2").ToString.Replace(vbCrLf, "")
How can we do it using linq query , because I need to do it for whole complete column
1 Like
You can try this
str = “Less usage of
Material required”
System.Text.RegularExpressions.Regex.Replace(str,"\r?\n"," ")
Try with this
YourDataTable = YourDataTable.AsEnumerable().ToList().ForEach(
Sub(row) row.SetField("YourColumnName", row.Field(Of String)("YourColumnName").Replace(vbLf, " ").Replace(vbCr, " "))
)
Cheers @yashashwini2322
It’s not working, throwing an error.
Oh
Try with this
I just removed set field
Use Invoke Code activity & execute the following code:
YourDataTable.AsEnumerable().ToList().ForEach(
Sub(row) row("ColumnName") = String.Join(" ", row("ColumnName").Split(Environment.NewLine.ToCharArray())))
)
Something like this
Cheers @yashashwini2322
system
(system)
Closed
October 1, 2023, 10:44am
10
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.