SubString and Index

if str=Notifications(656)
if I want to fetch only 656
str.subString(str.indexOf(“(”),str.indexOf(“)”)) not working

split(split(strInput,“(”)(1).ToString, “)”)(0).ToString.Trim

Try this…!


Hello @KarthikBallary,

Substring function will work with starting index and length of you required of substring , you need pass as parameters.

Ex : String = Anjaneevara prasad.

If I want to get substring like ‘vara’


7 is index and 4 is length of your excepted substring.

1 Like

Hey @KarthikBallary
The best option is to use a Regualr Expression to split out only numbers from string



There are some ways to do it.
If you want to only use substring and indexOf, it would be the following



1 Like

Str =“Notification(656)”

1). Create one Variable for example “Result” with data type - Match.
2). Assign Result = new Regex(“\d+”).Match(Str) .
3) In log message , write Result.Value
4). you can check you will get your desire result.
Output will be 656

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