3 Replies Latest reply: May 15, 2014 10:14 AM by Grant Perkins RSS

    Extract values in string separated by spaces

    roldgoldberg13 _

      Hello,

       

      I have strings of 6 different numbers that are separated by spaces (see below).  The values in each string have a varying number of characters.  Is there a way for me to extract all 6 values separately, using the spaces as identifiers?

       

      2,779 $1,240.29 1,708 $713.36 7,228 $2,916.89

      1,502 $601.08 669 $242.33 3,040 $1,119.41

      1,680 $350.08 320 $70.93 1,929 $484.49

       

      Thanks in advance for the help!

       

      Josh

        • Extract values in string separated by spaces
          elginreigner _

          You can use the Rsplit or Lsplit function. Is very handy, I probably use this as much as IF() and CTOD()/DTOC(). It will allow you to specify the field, number of values (6 in your case), the delimiter (space in this case), and the value to extract.

           

          Example: Lsplit(,6,' ',1) - This will give you the first value from the left, had it been Rsplit, it would have given you the first value from the right. Hope this helps.

            • Extract values in string separated by spaces
              roldgoldberg13 _

              Wow, much easier then I thought!  Thanks for your help, that is exactly what I was looking for.

                • Extract values in string separated by spaces
                  Grant Perkins

                  Wow, much easier then I thought!  [/QUOTE]

                   

                  Josh,

                   

                  Many things are much easier than you might imagine using Monarch functions alone or in combination. Sometimes it takes a problem opportunity, like this one, to stumble across one's basic understanding of what they can potentially do.

                   

                  I found, once I had tuned in to it after a year or so of using Monarch thinking that I had pretty much got it sussed, that I had so many new (to me) ways to approach problems that I was spoiled for choice. Even started to look for more and more problems to solve since it was clearly going to be quite easy ... mostly.

                   

                  Of course your motivation and that of your bosses may be different ....

                   

                   

                   

                   

                  Grant