I Want to remove all this Zeros in the Prefix of the Number from this excel file Meanwhile Printing it to another excel file But the number of Zero may vary in prefix We should make it dynamically

Screenshot 2022-03-03 173912
Screenshot 2022-03-03 173928
It Should Only remove prefix Zeros only

Hi @Gopikrishna_S ,

Could you try this and see if it works out for you?

image

image

dt.AsEnumerable.Select(Function(s) dt.Clone.LoadDataRow({System.Text.RegularExpressions.Regex.Replace(s(0).ToString,"^0+","")},False)).CopyToDataTable()

RemovePrefixedZeros.xaml (6.2 KB)

Kind Regards,
Ashwin A.K

Actually this Numbers are in the Fourth Column of the excel, is it work fine for that

Hi @Gopikrishna_S ,

That can be adjusted accordingly, if you can share a sample spreadsheet, I can help you out.
Since I am not aware of the schema, it will be difficult for me to provide you with an accurate resolution.

Could you please do the needful?

Kind Regards,
Ashwin A.K

Could you please privde this expression for single variable I am printing this Column Values inside the for each loop If I assign it for a particular Column so that it Wont dange the whole data table… I am taking This Row as Number=CurrentRow(2).ToString using assign activity if give any expression for Number variable means I will Implement It.

HI @Gopikrishna_S

Try this Regex expression

While looping through the column use this expression to get the values without ‘0’

System.Text.RegularExpressions.Regex.Replace(CurrentRow(“ColumnName”).ToString,"^0+","").tostring

image

Regards
Gokul

we can avoid the regex when using trimstart method
grafik

yourStringVar.TrimStart({"0"c})

1 Like

Hi @Gopikrishna_S ,

Is this what you meant?

System.Text.RegularExpressions.Regex.Replace(CurrentRow(3).ToString,"^0+","")

RemovePrefixedZeros_v1.xaml (8.8 KB)

Kind Regards,
Ashwin A.K