LucaMs Expert Licensed User Longtime User Dec 4, 2023 #1 B4X: Dim components() As String components = Regex.Split("", "1234") B4A: 5 strings - "" "1" "2" "3" "4" B4J: 4 strings - "1" "2" "3" "4" https://www.b4x.com/android/forum/threads/regex-split.157791/
B4X: Dim components() As String components = Regex.Split("", "1234") B4A: 5 strings - "" "1" "2" "3" "4" B4J: 4 strings - "1" "2" "3" "4" https://www.b4x.com/android/forum/threads/regex-split.157791/
M Mahares Expert Licensed User Longtime User Dec 4, 2023 #2 LucaMs said: B4A: 5 strings - "" "1" "2" "3" "4" Click to expand... You never quit Mario. I quickly tested and it shows 4 elements in B4A Code: Dim components() As String components = Regex.Split("", "1234") Log(components.Length) For i =0 To components.Length-1 Log(components(i)) Next Upvote 0
LucaMs said: B4A: 5 strings - "" "1" "2" "3" "4" Click to expand... You never quit Mario. I quickly tested and it shows 4 elements in B4A Code: Dim components() As String components = Regex.Split("", "1234") Log(components.Length) For i =0 To components.Length-1 Log(components(i)) Next
Sagenut Expert Licensed User Longtime User Dec 4, 2023 #4 I tested it too and I got 4 elements. Upvote 0
LucaMs Expert Licensed User Longtime User Dec 4, 2023 #5 Sagenut said: I tested it too and I got 4 elements. Click to expand... Upvote 0
Sagenut Expert Licensed User Longtime User Dec 4, 2023 #6 Where Regex come from? Is it included in Java JDK? Could it be something related to the Java version? @LucaMs which version of Java do you have in your path? I tested with Open JDK 14 and 17. Upvote 0
Where Regex come from? Is it included in Java JDK? Could it be something related to the Java version? @LucaMs which version of Java do you have in your path? I tested with Open JDK 14 and 17.
LucaMs Expert Licensed User Longtime User Dec 4, 2023 #7 Sagenut said: Where Regex come from? Is it included in Java JDK? Could it be something related to the Java version? @LucaMs which version of Java do you have in your path? I tested with Open JDK 14 and 17. Click to expand... That's exactly what I was writing: I can't think of a reason; Is it possible that it depends on the jdk used? JDK 8 Upvote 0
Sagenut said: Where Regex come from? Is it included in Java JDK? Could it be something related to the Java version? @LucaMs which version of Java do you have in your path? I tested with Open JDK 14 and 17. Click to expand... That's exactly what I was writing: I can't think of a reason; Is it possible that it depends on the jdk used? JDK 8
LucaMs Expert Licensed User Longtime User Dec 4, 2023 #8 Changed to jdk 14: same result, 5 strings Upvote 0
MarcoRome Expert Licensed User Longtime User Dec 4, 2023 #9 LucaMs said: Changed to jdk 14: same result, 5 strings Click to expand... Upvote 0
S Spavlyuk Active Member Licensed User Longtime User Dec 4, 2023 #10 I tested with Java 8 & 11 and don't get the empty string at the beginning either. Upvote 0
OliverA Expert Licensed User Longtime User Dec 4, 2023 #11 @lucas, can you upload the project that produces this issue? Upvote 0
LucaMs Expert Licensed User Longtime User Dec 4, 2023 #12 OliverA said: @lucas, can you upload the project that produces this issue? Click to expand... I tested the code in a B4XPages project I use for tests. It contains other stuff. Just now I created a new "default" project, compiled with jdk 14.0.1 (javac.exe, of course?): 5 strings! Attachments RegexTest.zip RegexTest.zip 9 KB · Views: 440 Upvote 0
OliverA said: @lucas, can you upload the project that produces this issue? Click to expand... I tested the code in a B4XPages project I use for tests. It contains other stuff. Just now I created a new "default" project, compiled with jdk 14.0.1 (javac.exe, of course?): 5 strings!
LucaMs Expert Licensed User Longtime User Dec 4, 2023 #13 LucaMs said: Just now I created a new "default" project, compiled with jdk 14.0.1 (javac.exe, of course?): 5 strings! Click to expand... Is it possible that even when I compile with jdk 14 javac.exe other jdk 8 files are used? But if that were the case, why doesn't the same thing happen with B4J? Upvote 0
LucaMs said: Just now I created a new "default" project, compiled with jdk 14.0.1 (javac.exe, of course?): 5 strings! Click to expand... Is it possible that even when I compile with jdk 14 javac.exe other jdk 8 files are used? But if that were the case, why doesn't the same thing happen with B4J?
LucaMs Expert Licensed User Longtime User Dec 4, 2023 #14 I uninstalled them. Again 5 strings (jdk 14.0.1) Upvote 0
OliverA Expert Licensed User Longtime User Dec 4, 2023 #16 It has nothing to do with the JDK you're using, but Android's implementation of (java.util.regex.Pattern) (if it is an actual problem). Are you doing this on a real device? What Android version? Links: B4A/B4AObjects/src/anywheresoftware/b4a/keywords/Regex.java at 2aeca9711cff3d32587a927935f6a34cc6655672 · AnywhereSoftware/B4A B4A core libraries. Contribute to AnywhereSoftware/B4A development by creating an account on GitHub. github.com https://developer.android.com/reference/java/util/regex/Pattern Upvote 0
It has nothing to do with the JDK you're using, but Android's implementation of (java.util.regex.Pattern) (if it is an actual problem). Are you doing this on a real device? What Android version? Links: B4A/B4AObjects/src/anywheresoftware/b4a/keywords/Regex.java at 2aeca9711cff3d32587a927935f6a34cc6655672 · AnywhereSoftware/B4A B4A core libraries. Contribute to AnywhereSoftware/B4A development by creating an account on GitHub. github.com https://developer.android.com/reference/java/util/regex/Pattern
OliverA Expert Licensed User Longtime User Dec 4, 2023 #18 This may be related to this issue: Splitting a String works in Java, doesn't work on Android So I have this logic which splits a String by 4 characters each. Something like this 0108011305080508000000 gives 0108 0113 0508 0508 0000 00 The logic I used is String [] splitErrorCode = input... stackoverflow.com Upvote 0
This may be related to this issue: Splitting a String works in Java, doesn't work on Android So I have this logic which splits a String by 4 characters each. Something like this 0108011305080508000000 gives 0108 0113 0508 0508 0000 00 The logic I used is String [] splitErrorCode = input... stackoverflow.com
LucaMs Expert Licensed User Longtime User Dec 4, 2023 #19 OliverA said: Are you doing this on a real device? What Android version? Click to expand... Yes, Android 8, but the question was asked by another Italian member, who most likely has a more recent Android. Upvote 0
OliverA said: Are you doing this on a real device? What Android version? Click to expand... Yes, Android 8, but the question was asked by another Italian member, who most likely has a more recent Android.
Sagenut Expert Licensed User Longtime User Dec 4, 2023 #20 This can be a really important information to think about if some user/client report a bug and we are not able to replicate it. Something to remeber. Upvote 0
This can be a really important information to think about if some user/client report a bug and we are not able to replicate it. Something to remeber.