You need to sign in to do that
Don't have an account?
shweta chadha 4
take the substring out of string in salesforce
Hello,
I am creating the html template in Salesforce and below is value i am fetching from one field that is building address. However, i just need the building number from the entire address. Below is the scenario.
“Václavské náměstí 785/28, P1 - Alfa Building”, this is the text and I want to extract the only the number i.e 785/28. But the thing is the numbers before and after the ‘/’ varies it can be more than 3 or 2 digits. Trim Left and Right work but can't seem to specify the values dynamically.
Thanks, Shweta
I am creating the html template in Salesforce and below is value i am fetching from one field that is building address. However, i just need the building number from the entire address. Below is the scenario.
“Václavské náměstí 785/28, P1 - Alfa Building”, this is the text and I want to extract the only the number i.e 785/28. But the thing is the numbers before and after the ‘/’ varies it can be more than 3 or 2 digits. Trim Left and Right work but can't seem to specify the values dynamically.
Thanks, Shweta
I suppose you need to use Pattern and Matcher.
Please see below sample code:
Let us know if this works for you.
Best Regards,
BALAJI