Peforms the same action based on number of rows inside the web page

can you specify the code that not working?
Need to understand from where to remove 2 characters, first or last 2 characters…

It’s good for you to check this post…it will help you to understand how to work with strings…

I hope it helps…