Hi,
Actually I have a String that contains 10 characters and I need to extract last 8 from it and if it contains 00 in starting than discard the 0’s also.
String is
100066862
Hi @Kunal_Jain ,
Could you try with the below Expression :
"100066862".Substring(2).TrimStart("0".ToCharArray)
You can take the substring from 2 initially which will give you last 8 digits(your string is 10 characters), then check if that starts with 00, if yes, again take substring from 2. Attaching screenshot below
That is not confirm that the size of the string will be 10 everytime
It can vary
Hi @Kunal_Jain ,
In that case, could you try using the below Expression :
"100066862".Substring("100066862".Count-8).TrimStart("0".ToCharArray)
Number
100066862
100072121
100072640
100067905
100072964
100066742
100072964
100072057
100072964
Actually This is the excel format of the column and I need to convert all in the same manner
When you would want to update the values within the Excel Data, we can go ahead with the Datatables Operations, mainly with For Each Row
activity and update the value using an Assign
activity with the Expression provided.
Have you tried using the combination of For Each Row
and Assign
activities, could you let us know what have you tried or what are you expecting ?
Actually I have not tried for each activity and I need to use it
Hi @Kunal_Jain
- Use a read range activity to retrieve all the data from excel
- Use a for each row activity with this
CurrentRow("Number") = CurrentRow("Number").ToString.Substring(CurrentRow("Number").ToString.Count-8).TrimStart("0"c)
- Last use a write range to write it back to excel
Regards
Is there a way where we can use it in invoke code activity??
Hi @Kunal_Jain ,
Use the following in invoke code, by keeping the dt as in/out argument:
dt.AsEnumerable().ToList.ForEach(Sub(row) row("Number") = row("Number").ToString.Substring(row("Number").ToString.Count-8).TrimStart("0"c))
Regards,
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.