How to get specific text after a special symbol "#"

Hello All,

please help me to get text or integer after “#” and to end of that number.

FIELD VERIFICATION AND REQUIRED WORK FOR PROPOSAL #2019-109-0186

Thanks in Advance!!

1 Like

Hi @Srinu6038,

Use IndexOf method to find the position of the “#” symbol. Then just use a substring to get that number. I will leave the links down below if you want more info about these 2 methods. Also ou can also use regex but that’s up to you, substring is easier in my personal opinion but it depends on each escenario.


3 Likes

Hi
Hope this expression would help you resolve this
If the input is stored in a variable named strinput
Then in assign activity
stroutput = Split(strinput.ToString,”#”)(1).ToString.Trim

Cheers @Srinu6038

1 Like

thanks Palani.
what if i have more text after that number ?
i want only that integer number.
FIELD VERIFICATION AND REQUIRED WORK FOR PROPOSAL #2019-109-0186 O’CALC IN SPANS

Awesome
In that case use Regex like this
Stroutput = System.Text.RegularExpressions.Regex.Match(strinput.ToString,”(?<=#).*(\d)”).ToString.Trim**

Cheers @Srinu6038

1 Like

Hello @Srinu6038, If you want everything after “#” then you can use following:

variableName.Substring(variableName.IndexOf("#") + 1).Replace("-","")

Regards

thanks Palani!

its working…

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