[Thread Prev][Thread Next][Index]

Re: [ferret_users] existence of elements in array



Hello Akshay,

On 16 Jun 17:45 Akshay Hegde wrote:
> Make use of "IS_ELEMENT_OF" function
> 
> [root@localhost tmp]# f
>      NOAA/PMEL TMAP
>      FERRET v6.96
>      Linux 2.6.32-573.7.1.el6.x86_64 64-bit - 12/02/15
>      16-Jun-17 17:42
> 
> yes? let aa = {1, 2, 3};
> yes? list IS_ELEMENT_OF(aa, 3)
>              VARIABLE : IS_ELEMENT_OF(AA, 3)
>              X        : 1
>           1.000
> yes? list IS_ELEMENT_OF(aa, 35)
>              VARIABLE : IS_ELEMENT_OF(AA, 35)
>              X        : 1
>           0.0000
> yes? IF `IS_ELEMENT_OF(aa, 35) NE 0` THEN
>  !-> IF 0 THEN
> yes? say 'exists'
> yes? ELSE
> yes? say 'does not exists'
> 'does not exists'
> yes? ENDIF
> yes?

Thank you, this works for number arrays!

I want to do the same for arrays of strings.  This function doesn't
take strings, but I found a very similar function for that:

    yes? let ss = {"a", "b", "c"};
    yes? list IS_ELEMENT_OF_STR(ss, "c")
                 VARIABLE : IS_ELEMENT_OF_STR(SS, "c")
                 X        : 1
              1.000
    yes? 

Fantastic.

 - Marco


[Thread Prev][Thread Next][Index]
Contact Us
Dept of Commerce / NOAA / OAR / PMEL / Ferret

Privacy Policy | Disclaimer | Accessibility Statement