Android Question Extract phone number from a string

svk123

Member
Licensed User
Longtime User
Hello,

I have a string similar to the one mentioned below that I am displaying in a label inside a scrollview:
"Last called John on 21/12/2016. Call again 9013451234 on 21/1/2017."

Is there any function that can recognize the position of the phone number from the string above, like look for consecutive 10 or 12 numbers in the string? I can then put a "<a href='tel:9013451234'>9013451234</a>" for the next 10 or 12 characters so that when user clicks it, the control will go to the phone dialer.

Or

Is there any other method to recognize the phone number from the string?

Thanks,
Sachin
 

svk123

Member
Licensed User
Longtime User
Thank you for your reply Erel. I am getting an unknown member error for regex.replace . I am using b4a v6.0. Am I missing a library?
 
Upvote 0
Top