Hi Team,
I have a task wer i have to extract a specific number from string so below is the exacmple
I want to extract 8 from below string
H + 8
please help me to achieve this
= 8
Hi Team,
I have a task wer i have to extract a specific number from string so below is the exacmple
I want to extract 8 from below string
H + 8
please help me to achieve this
= 8
If it is always after 8 and in same format then
requirednumber = Str.Split("+"c).Last.Trim
Cheers
number is not constant, it wont be always 8
Will the number always be at the end of the string, and can be greater than 9?
As I said number need not be constant but it should be always after + and number should be the last one present after +
Cheers
Try this:
Input = "H + 8"
Output = System.Text.RegularExpressions.Regex.Match(Input, "(?<=\+\s*)\d+").Value.Trim()
The above syntax will extract what ever may be the number present after +
Regards
Try this
\d+
System.Text.RegularExpressions.Regex.Match(Input, "\d+").Value
Regards,
Hello
To learn more about Regex take a look here ![]()
Cheers
Steve