Trim characters on the string

I have a string variables which consists of 22 or 23 alpha numeric characters. I want to shortern this to 16 characters. Need to remove the characters within the forward slashes also need to remove the slashes too. How to do this ??
Attached some examples
Variable 1: ABCD123456/AB/C/123456
Variable 3: ZXYZ987653/MK/YD/098123
Variable 4: QWER456789/VS/P/[889933

regex replace can help:


grafik

System.Text.RegularExpressions.Regex.Replace(YourStringVar,"\/.*\/","")

Hello @Praveen_Vs , Try Regex replace method

System.Text.RegularExpression.regex.Replace(Yourstring,"\/.*\/.*\/\W|\/.*\/.*\/","").ToString.Trim

image

Hey @Praveen_Vs

Use the below method

startIndex = str.IndexOf("/")
EndIndex = str.LastIndexOf("/")
str = str.Substring(0, startIndex)+str.Substring(EndIndex+1)

Thanks,
Sanjit