Split text?

I want split text as below.

Suspend_de_20210613_175410.xlsx

I want out put show Suspend_de

Please guide me about it.

@fairymemay

Check below for your reference

sampleString.Substring(0,(sampleString.IndexOf("_",sampleString.IndexOf("_")+1)))

Above expression will split the text at second occurence of " _"

Hope this may help you

Thanks

1 Like

@fairymemay - Another solution…

image

 "Suspend_de_20210613_175410.xlsx".Split("2"c)(0).trim("_"c)

Assuming you will get 2021 always

"Suspend_de_20210613_175410.xlsx".Split({"2021"},StringSplitOptions.None)(0).trim("_"c)

to make generalized

"Suspend_de_20210613_175410.xlsx".Split({now.year.tostring},StringSplitOptions.None)(0).trim("_"c)
2 Likes

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