REXYGEN Community Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Login

    How to create substring

    REXYGEN Studio
    rexlang string
    3
    8
    642
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • M
      martijnperdaan
      last edited by cechurat

      is it possible in a rexlang fuction block that i have a string (00011110101010101010101)
      split into 2 strings

      1 Reply Last reply Reply Quote 0
      • M
        martijnperdaan
        last edited by

        the first 5 numbers in string 1 the other 5 in string 2 the rest in string 3

        cechuratC 1 Reply Last reply Reply Quote 0
        • cechuratC
          cechurat @martijnperdaan
          last edited by

          @martijnperdaan
          Hi Martijn,

          REXLANG:
          you can create substring in REXLANG using function

          string 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=279

          Regards, Tomas

          1 Reply Last reply Reply Quote 0
          • M
            martijnperdaan
            last edited by

            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

            1 Reply Last reply Reply Quote 0
            • M
              martijnperdaan
              last edited by

              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

              1 Reply Last reply Reply Quote 0
              • jaroslav_sobotaJ
                jaroslav_sobota
                last edited by

                Hello Martijn,
                see this example project: 0203-03 Built-in functions

                As 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

                1 Reply Last reply Reply Quote 0
                • M
                  martijnperdaan
                  last edited by

                  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%?

                  1 Reply Last reply Reply Quote 0
                  • jaroslav_sobotaJ
                    jaroslav_sobota
                    last edited by

                    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

                    1 Reply Last reply Reply Quote 0
                    • First post
                      Last post

                    This is a community forum for REXYGEN users and fans. Detailed information can be found at REXYGEN homepage.

                    There is also an outdated REXYGEN community forum.

                    Powered by NodeBB.