cancel
Showing results for 
Search instead for 
Did you mean: 

Extract number from a string

MadalinaAcsinte
Level 3
Hello,

I would like to extract a number from a string that look like this:

"12345678-Name of the company"

I want to extract the value with the replace function in a calculation stage:

Trim(Replace([Item Data], Right([Item Data], InStr([Item Data], "-")), ""))

I tried in several ways but is not extracting the part I want, the number until "-".
Any ideas on how I should do it?

Thank you,

------------------------------
Madalina Acsinte
------------------------------
2 REPLIES 2

ewilson
Staff
Staff
Hi @MadalinaAcsinte,

If the number is always at the start of the string give this a try:

Left([Data3], InStr([Data3], "-") - 1)

Just replace the "Data3" names with whatever the name of your data item is.

Cheers,

------------------------------
Eric Wilson
Director, Partner Integrations for Digital Exchange
Blue Prism
------------------------------

Hello, Madalina,

I know that you want to extract it via calculation stage and String function but there is also other way so that you are aware. There is a business object (digital exchange AVO.Regex) which is used to perform regular expression operation. So you can call that business object with regular expression "\d*" and it will return all the digits from your string.

Regards,

------------------------------
Zdeněk Kabátek
Head of Professional Services
NEOOPS
http://www.neoops.com/
Europe/Prague
------------------------------