3 Replies Latest reply: Nov 23, 2016 8:50 AM by Ali S RSS

    set

    Ali S

      Words Length from string:

      How we get the length of word from the string.i.e

       

      i have string as below,

      > this is a car.

      so i am expecting the result as 4 2 1 3

       

       

      thanks in Advanced .

        • Re: set
          Stefan Wühl

          Maybe something along this (INLINE table is only for demonstration, use your table source instead):

           

           

           

          LOAD string, CONCAT(numChar,' ',index) as numChars

          GROUP BY string;

          LOAD *, LEN(word) as numChar;

          LOAD *, SUBFIELD(string,' ',iterno()) as word, iterno() as index

          INLINE [

          string

          this is a car

          ]

          WHILE iterno() <= SUBSTRINGCOUNT(string, ' ')+1;

           

           

           

          string numChars
          this is a car4 2 1 3
          • Re: set
            Gysbert Wassenaar

            and if you want a chart expression:

             

            =$(=concat( 'Len(Subfield(''this is a car'','' '',' & ValueLoop(1, SubStringCount('this is a car',' ')+1) & '))' , ' & '' '' & '))

             

            sillytricksdepartment