1 Reply Latest reply on Jul 16, 2018 2:12 PM by Stewart Crighton

    Strip Function

    Gazal Sharda

      Hi All,

       

      We need to strip 'net' from a string occurring at the beginning of the string .

       

      For eg.

       

      From: nettm808 , we just need 'tm808' .

       

      However the strip function we are using : $parameter2= strip($parameter1,4,'net') is giving us output as 'm808' as it is also stripping 'n' , 'e , 't' wherever existing at the beginning.

       

      So please let me know the function name where we can strip the entire string 'net' from the starting.

        • 1. Re: Strip Function
          Stewart Crighton

          Methods I have used in the past for this....

          This is a bit freehand, and may not work...  but the basics is to find the position of the string you want then use that as part of the substring command:

           

          $parameter2 = substring($parameter1,(len(listgetelt(strtolist($parameter1,"net"),1)) + 1)) ;

           

           

          The other is to use regex:

           

          $parameter2 = listgetelt(match_regex($parameter1,'^net(.*)',''),1);

           

          I personally prefer regex, but note that the more regex you use the more overhead the cell will have.