• Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    String to number?

    Scheduled Pinned Locked Moved Mervis
    8 Posts 3 Posters 3.9k Views
    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
      Matt
      last edited by

      Follow-up question now that I have serial communication figured out. Is there a function available to parse a string into a float? I can't find anything in the help docs.

      T 2 Replies Last reply
      Reply Quote 0
      • T
        tomas_hora administrators @Matt
        last edited by

        @mdturnerphys As far as I know, there is no such fbd because TO_REAL does not handle string

        1 Reply Last reply
        Reply Quote 0
        • T
          TomasKnot
          last edited by

          @mdturnerphys

          To add to what @tomas_hora said, string parsing in general has to be done via ASCII lookups unfortunately.

          1 Reply Last reply
          Reply Quote 0
          • T
            tomas_hora administrators @Matt
            last edited by

            @mdturnerphys Thanks for popping up the topic. TO_REAL function will be able to parse string to float in the upcoming release

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

              I started creating my own function to do it named "string_to_real" and then got an error saying that the function already existed. It does show up in the autocomplete list, and I can build a project using it, but it doesn't appear to work.

              EDIT: It looks like it only works for single-character strings. "2" gets converted to 2, but "23" gets converted to 0.

              1 Reply Last reply
              Reply Quote 0
              • T
                TomasKnot
                last edited by

                @mdturnerphys

                I am aware of the function, but as you saw it is not quite up to the task. It should work much more robustly in the next Mervis release, but we unfortunately do not have a firm release date yet.

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

                  Just thought I'd check for updates on this. Thanks.

                  T 1 Reply Last reply
                  Reply Quote 0
                  • T
                    TomasKnot @Matt
                    last edited by

                    Hi @matt

                    I believe the latest version of Mervis should be able to handle it better now; you can give it a go and see if it works properly with multi-character strings. For further information please get in touch with [email protected] and/or Martin Kudláček instead, as I will be leaving unipi shortly.

                    1 Reply Last reply
                    Reply Quote 0

                    Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                    Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                    With your input, this post could be even better 💗

                    Register Login
                    • First post
                      Last post