I have 2 columns in datatable with string values
I want to remove all spaces in between & special characters from that two columns
Can anyone please suggest query
I have 2 columns in datatable with string values
I want to remove all spaces in between & special characters from that two columns
Can anyone please suggest query
Hi @Demo_User
Can you provide the sample file or screen shot of the data, so that we can analyze your requirements?
Best Regards.
Please try using this
Currentrow(0) = system.Text.RegularExpressions.Regex.Replace(currentrow(0),"[^A-Za-z0-9 ]","").Trim
Currentrow(1) = system.Text.RegularExpressions.Regex.Replace(currentrow(1),"[^A-Za-z0-9 ]","").Trim
Hope this helps
Cheers
Hi @Demo_User
You can use below approach as well
Use a “Replace” activity to remove spaces and special characters from each value in the two columns.
a. Drag and drop a “Replace” activity inside the “For Each Row” activity
.b. In the “Properties” panel of the “Replace” activity, set the following properties:
Repeat above for the second column,
Hi @Demo_User
You can try this approach using invoke code activity
dt1.AsEnumerable().ToList().ForEach(Sub(row) row("col1") = System.Text.RegularExpressions.Regex.Replace(row("col1").ToString.Trim,"[^A-Za-z0-9]","")
dt1.AsEnumerable().ToList().ForEach(Sub(row) row("col2") = System.Text.RegularExpressions.Regex.Replace(row("col2").ToString.Trim,"[^A-Za-z0-9]","")
Then outside the invoke code, use write range to write the updated dt1 to the excel file.
Note: Here col1, col2 are the representing the two columns from which u need to remove special characters and spaces, you can replace with desired column names
Hope this helps
Thanks & Regards,
Nived N
Exception has be thrown by target of an invocation … showing as invalid pattern
Hi @Demo_User
Just check my earlier response, i think issue was due to quotes
Just try the code once again and let me know if it worked as expected
Could u share screenshot of invoke code and the arguments
did it worked for you
Yes, thanks thats working
Good to know
Have a great day
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.