S svk123 Member Licensed User Longtime User Jan 4, 2017 #1 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
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
Erel B4X founder Staff member Licensed User Longtime User Jan 4, 2017 #2 Code: Dim s As String = "Last called John on 21/12/2016. Call again 9013451234 on 21/1/2017." Dim s2 As String = Regex.Replace("\d{10,12}", s, "<a href='tel:$0'>$0</a>") Log(s2) Upvote 0
Code: Dim s As String = "Last called John on 21/12/2016. Call again 9013451234 on 21/1/2017." Dim s2 As String = Regex.Replace("\d{10,12}", s, "<a href='tel:$0'>$0</a>") Log(s2)
S svk123 Member Licensed User Longtime User Jan 9, 2017 #3 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
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?
Erel B4X founder Staff member Licensed User Longtime User Jan 9, 2017 #4 It was added in a newer version of B4A. Search the forum you should be able to find an implementation based on JavaObject. Upvote 0
It was added in a newer version of B4A. Search the forum you should be able to find an implementation based on JavaObject.
S svk123 Member Licensed User Longtime User Jan 9, 2017 #5 Thanks..used regexreplace https://www.b4x.com/android/forum/threads/regex-and-replace.15677/#post-88971 Upvote 0
Thanks..used regexreplace https://www.b4x.com/android/forum/threads/regex-and-replace.15677/#post-88971