Trim Column

Hello,

I have this excel where the code column has values in the format of “IPxxxx”. I just want the numbers, that is, remove the “IP” in front of it.

However, in some excels, the “IP” has already been removed. So how can we implement this? Like, check if there is “IP” then remove or else continue.

Before:
image

After:
image

Thanks!

1 Like

Hi

Hope the below expression would help you resolve this

Use a Invoke activity like this

dt.AsEnumerable.ToList.ForEach(Sub(row) row(“Code”)= row(“Code”).ToString.Replace(“IP”, ””))

Cheers @Yudhisteer_Chintaram1

in general we can trim:
grafik

A flow could look like this:
grafik
row("Code").toString.TrimStart(" IP".ToCharArray)

1 Like

I get this however:

The mentioned LINQ statement cannot be used within an Assign activity, due it has no return to the left side.

You can use it within an invoke code activity. But we would recomment to do the update within a for each row and an assignment as shown above

1 Like

Thanks for the mention
My bad @ppr