HI Team,
I need to get the last n characters till space from a column and paste that in to a new column .
Input:
Name | Special |
---|---|
KK JJ PPP | |
NN II KKKK |
Output:
Name | Special |
---|---|
KK JJ | PPP |
NN II | KKKK |
HI Team,
I need to get the last n characters till space from a column and paste that in to a new column .
Input:
Name | Special |
---|---|
KK JJ PPP | |
NN II KKKK |
Output:
Name | Special |
---|---|
KK JJ | PPP |
NN II | KKKK |
try this
dt.AsEnumerable.ToList.ForEach(sub(r) r("NewColumn") = r("OldColumn").ToString.Trim.Split({" "},StringSplitOptions.None).Last)
cheers
Hi,
Can you try the following sample?
CurrentRow("Special")=CurrentRow("Name").ToString.Split({" "c}).Last()
CurrentRow("Name")=System.Text.RegularExpressions.Regex.Replace(CurrentRow("Name").ToString,"\s+\S+$","")
Sample20231003-1L.zip (3.1 KB)
Regards,
One of many options
For each Row in DataTable Activity | row in dtData
System.Text.RegularExpressions.Regex.Match(row("Name").toString.Trim,"(.*)(\ .*)")
row("Name") = myMatch.Groups(1).Value.Trim
row("Special") = myMatch.Groups(2).Value.Trim
Thanks its working from your code
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.