Check cell value based on columns

how to check if a particular column has 12 digits number right to left and eliminate extra from left

A couple of options:

Validate the length

  • using a regular expression like \d{12}
  • use string.Length

Finally remove the undesired value with a substring

Hi @Reni_Sweta,

You can test the following to get what you want.

value = 1312313123131
value = if(value.Length>12,value.Substring(value.Length-12,12),value)

Regards,
MY

Thanks for your solution.

I need to do this check for each row in dt for some specific columns
How to do this?

Hi @Reni_Sweta,

You can follow these steps for each row in the loop.

1-CurrentRow("ColumnName").ToString

2-if(strFirst.Length>12,strFirst.Substring(strFirst.Length-12,12),strFirst)

Regards,
MY