Remove part of string after last occurrence of delimiter "/"

Need help,

Input string 1: a/b/c/d/efgh
Input string 2: a/b/c/ighjkl

Need OutPUt:

Ouptut 1: a/b/c/d
Output 2: a/b/c/

we can do it with regex:
grafik

or using string method Split and join it again

2 Likes

As an alternate (optimistic approach)
grafik

Hello Mahaveer,

You can simply do it by
str.Substring(0,str.LastIndexOf(“/”)).ToString

where str must be you string variable.

Hope this helps.

Regards,
Saloni

1 Like

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