Getting 1st substring from a string

Hi, I am new to the platform.
I want to split a string and type the 1st substring. My string format is AB Cdefg [ishksn90]. And expected output is AB Cdefg.
Please help with this.
Thanks in advance.

I’d recommend using regex. You can do something simple like: Assign MySubString = System.Text.RegularExpressions.Regex.Match(YourString,"\w+\s\w+").Value

1 Like

input = “AB Cdefg [ishksn90]”

output= input.SubString(0,input.IndexOf("[")+1)

U can have a try on this too using substring approach

1 Like

Thanks this works :+1:

1 Like

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