Replace the last letter of each string in a datatable column

Hello,

In dt, there is a column “Animals”
How to replace the last letter of each item as such:

cows, horses, skunks, pigs > cow(s), horse(s), skunk(s), pig(s)?

Thank you

1 Like

Hi @PPIM_RPA

1. Read Range (Input: Excel ) > Output: dt

2. For Each Row (Input: dt)
   - Assign: row("Animals") = System.Text.RegularExpressions.Regex.Replace(row("Animals").ToString, "s$", "(s)")

3. Write Range (Input: dt, Output: Excel)

1 Like

Perfect. That worked. Thank you

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.