B4R Question strings- list?

ilan

Expert
Licensed User
Longtime User
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
Upvote 0

ilan

Expert
Licensed User
Longtime User
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.
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

B4X founder
Staff member
Licensed User
Longtime User
Upvote 0
Top