Remove part of a string


Hello friends,
I need to manipulate the "Contraente " column so that it eliminates the part of the string “ProprietarioCATTANEO MARIKA SONIA” because it contains a repatition of the first part.
20180709.xlsx (22.7 KB)

How can I manipulate the string?
Thank you so much,
Camilla. :slight_smile:


Hey @CamiCat

You can use String.Remove function!

Assuming you only want to change that particular cell , you could do something like this(assuming str is holding the value at specified cell)

str = str.Remove(str.IndexOf(“Proprietario”))

If you are iterating through the whole DataTable you can check
if row(“Contraente”).ToString.Contains(“Proprietario”)
then row(“Contraente”)=row(“Contraente”).ToString.Remove(row(“Contraente”).ToString.IndexOf(“Proprietario”))

Hope this helps :slight_smile:



Thank you so much @Rishabh_Lakhera.
I’ll try with your suggestion and let you know as soon as possible.
Camilla :slight_smile:


Unfortunately I tried your solution but it doesn’t work.
have you kindly got any other ideas?
Thank you so much,
Camilla :slight_smile:


Are you getting an error? Or an unchanged string? Because i tried the same on a test string and it worked fine!


Hi @CamiCat,
I have done the sample for this situation.

File : (18.4 KB)



Thank you so much @balupad14.
Your solution is very good.
Camilla :slight_smile: