How to remove special characters except two column

Dear All,

Please help me how to special characters in csv file except two columns.

Thanks in Advance…!

Hi @SURESH_P,

Use update row item like below Or if you are looking for a solution through Linq, tell me how many columns there are and where you expect the columns to come from

Thanks,
Rajkumar

Dear Rajkumar,

We have 168 columns need to replace special characters in 166 columns except 2 columns.

Thanks in Advance…!

@SURESH_P
Except for two column means, is it the last two columns or a random one?
If it is the last two columns, get the count of the column and using loops, we could achieve it.


HI,

Hope the following sample helps you.

Dim colList As List(Of String) = dt.Columns.Cast(Of DataColumn).Select(Function(dc) dc.ColumnName).Where(Function(s) Not excludeCol.Contains(s)).ToList
dt.AsEnumerable.ToList.ForEach( 
Sub(r)
    colList.ForEach(
    Sub(c)
	    r(c)=System.Text.RegularExpressions.Regex.Replace(r(c).ToString,"[\W_]","")
    End Sub
    )
End Sub
)

Main.xaml (9.8 KB)

Regards,

Dear Sangeetha,

It’s random column, like “N & U” Column

Dear Yoichi,

Exclude Columns also replace while using the attached xaml file.

Thank…!

HI,

Can you share input csv file and information for exclude columns?
It’s no problem if dummy data.

Regards,

Introduce if and check the column name is N or column name U in else part put that update row item activity

Dear Yoichi,

For your better understanding, Need to remove below mentioned Special charaters and replace characters.

Find Text Replace Text
+ Space
, Space
* Space
# Space
$ Space
; Space
/ -
-
 Space