How to create substring
-
is it possible in a rexlang fuction block that i have a string (00011110101010101010101)
split into 2 strings -
the first 5 numbers in string 1 the other 5 in string 2 the rest in string 3
-
@martijnperdaan
Hi Martijn,REXLANG:
you can create substring in REXLANG using functionstring strsub(str,idx,len)
Returns a substring of length len starting at index idx
For more details on String functions in REXLANG see docs: https://www.rexygen.com/doc/PDF/ENGLISH/BRef_ENG.pdf#page=442
Function blocks:
It is also possible to create substring using function block called MID.
For more details on String Function blocks see docs:
https://www.rexygen.com/doc/PDF/ENGLISH/BRef_ENG.pdf#page=279Regards, Tomas
-
can you give me an example of a piece of code where I use this string strsub (str, idx, len) whatever I try I keep getting an error Error compiling file 'srcfile.c' (line 31): syntax error
-
I succeeded through the MID block. But can I also switch between string that I get, for example, string 1 when input 1 goes high and string 2 when input goes high and so on until string 20
-
Hello Martijn,
see this example project: 0203-03 Built-in functionsAs for switching string signals, use the SELSOCT block. For 20 strings, you'll need 3 of them. Did you miss it in the list of functions blocks for processing string signals in REXYGEN?
Hope this helps, let me know.
Jaroslav
-
Thanks it works
Is there also a function block that if the input is high it will bring the analog output to 100% if it is still high then counts back to 0% and if it is still high it will go back to 100%?
-
Please start a new topic for questions not directly related to the original question.
There is no such block, you must combine the existing blocks to achieve this.
Jaroslav