rwblinn Well-Known Member Licensed User Longtime User Sep 26, 2015 #1 Hi, is there a B4J equivalent (without using Inline Java and JavaObjects) for Java's B4X: public String replaceAll(String regex, String replacement) To use for example in string conversion from BB to HTML. B4X: "\\[b\\](.+?)\\[/b\\]", "<bold>$1</bold>" Last edited: Sep 26, 2015
Hi, is there a B4J equivalent (without using Inline Java and JavaObjects) for Java's B4X: public String replaceAll(String regex, String replacement) To use for example in string conversion from BB to HTML. B4X: "\\[b\\](.+?)\\[/b\\]", "<bold>$1</bold>"
Erel B4X founder Staff member Licensed User Longtime User Sep 27, 2015 #2 You will need to use JavaObject: B4X: Sub RegexReplace(Pattern As String, Text As String, Replacement As String) As String Dim jo As JavaObject = Regex.Matcher(Pattern, Text) Return jo.RunMethod("replaceAll", Array(Replacement)) End Sub Upvote 0
You will need to use JavaObject: B4X: Sub RegexReplace(Pattern As String, Text As String, Replacement As String) As String Dim jo As JavaObject = Regex.Matcher(Pattern, Text) Return jo.RunMethod("replaceAll", Array(Replacement)) End Sub