Hi
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…!
Thanks!
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’
Sring.substring(7,4)
7 is index and 4 is length of your excepted substring.
Hey @KarthikBallary
The best option is to use a Regualr Expression to split out only numbers from string
Thanks!
Hi,
There are some ways to do it.
If you want to only use substring and indexOf, it would be the following
str.Substring(str.IndexOf("(")+1,str.IndexOf(")")-str.IndexOf("(")-1)
Regards,
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.