ilan Expert Licensed User Longtime User Jun 23, 2022 #1 hi i would like to run a g-code that is build of up to 20 lines. each line with have 3 parameters for 3 axis and each will have a value (number) something like this: Z5 C10 A0 Z0 C0 A10 .. my question is how could i archive this in b4r. in any other b4x ide i can do it easily with regex. split and some loops i know i can do it also in b4r but what would be the most efficient way? if i would create type object is it ok? what about memory? is it better not to use to much global variables to save memory? i was thinking of storing the whole code as a global string and build a function to split it and perform the action. what do you say?
hi i would like to run a g-code that is build of up to 20 lines. each line with have 3 parameters for 3 axis and each will have a value (number) something like this: Z5 C10 A0 Z0 C0 A10 .. my question is how could i archive this in b4r. in any other b4x ide i can do it easily with regex. split and some loops i know i can do it also in b4r but what would be the most efficient way? if i would create type object is it ok? what about memory? is it better not to use to much global variables to save memory? i was thinking of storing the whole code as a global string and build a function to split it and perform the action. what do you say?
Erel B4X founder Staff member Licensed User Longtime User Jun 23, 2022 #2 The handling of strings in B4R is very different than in the other platforms. Start here: https://www.b4x.com/android/forum/threads/strings-and-bytes.66729/#content One possible option: https://www.b4x.com/android/forum/threads/module-queue-list.81334/#content Another one is to use ByteConverter.Split and iterate over the rows. Upvote 0
The handling of strings in B4R is very different than in the other platforms. Start here: https://www.b4x.com/android/forum/threads/strings-and-bytes.66729/#content One possible option: https://www.b4x.com/android/forum/threads/module-queue-list.81334/#content Another one is to use ByteConverter.Split and iterate over the rows.
ilan Expert Licensed User Longtime User Jun 23, 2022 #3 Erel said: The handling of strings in B4R is very different than in the other platforms. Start here: https://www.b4x.com/android/forum/threads/strings-and-bytes.66729/#content One possible option: https://www.b4x.com/android/forum/threads/module-queue-list.81334/#content Another one is to use ByteConverter.Split and iterate over the rows. Click to expand... thanx erel, i was thinking of the second option. are there any limitations in b4r when using split like in b4x? i mean when using special chars like "|" do we need to use "/|" like in b4x? does b4r has the String.Contains() method? i could not find it Upvote 0
Erel said: The handling of strings in B4R is very different than in the other platforms. Start here: https://www.b4x.com/android/forum/threads/strings-and-bytes.66729/#content One possible option: https://www.b4x.com/android/forum/threads/module-queue-list.81334/#content Another one is to use ByteConverter.Split and iterate over the rows. Click to expand... thanx erel, i was thinking of the second option. are there any limitations in b4r when using split like in b4x? i mean when using special chars like "|" do we need to use "/|" like in b4x? does b4r has the String.Contains() method? i could not find it
Erel B4X founder Staff member Licensed User Longtime User Jun 23, 2022 #4 ilan said: do we need to use "/|" like in b4x? Click to expand... No. It is required in B4X because it is a regex split. ilan said: does b4r has the String.Contains() method? i could not find it Click to expand... Yes (IndexOf). Start here: https://www.b4x.com/android/forum/threads/strings-and-bytes.66729/#content Upvote 0
ilan said: do we need to use "/|" like in b4x? Click to expand... No. It is required in B4X because it is a regex split. ilan said: does b4r has the String.Contains() method? i could not find it Click to expand... Yes (IndexOf). Start here: https://www.b4x.com/android/forum/threads/strings-and-bytes.66729/#content