Replace data before slash if present

hi team,
i have an excel column which might have data as tcs\sam, or just sam…
i want the bot to remove data before slash and output to be just sam…if there is any data like “tcs\sam” present.
Input Output
tcs\sam sam
Infosys\jerry jerry
sam sam
jersey jersey

please help.

@som17 Suppose str = “tcs\sam”
Then you can use this in a Message Box and check it’s Output

if(str.Contains("\"),Split(str,"\")(Split(str,"\").Count-1),str)

1 Like

@som17 - you can try with String.Substring option like below…

 str = “tcs\sam”
 str = str.Substring(str.IndexOf('\') + 1)
2 Likes