[Prev][Next][Index][Thread]

# Re: Case (in)sensitivity

- Date: Tue, 5 Dec 1995 03:20:21 PST
- From:

    Message-ID: red-45-msg951205191957MTP[01.51.00]000000b9-21848

    >  If you are using the 1.7.9p2 server version, replace lines like:
    >    if( "Sinjin" in (player_name_list))
    >
    >  with:
    >    if( is_member( "Sinjin", player_name_list ))
    >
    >  If you are not using 1.7.9p2 or better, upgrade. ;)  The 1.7.8p4 version
    >  of the above line is:
    >    if( (i = "Sinjin" in (player_name_list)) && !strcmp( "Sinjin",
    >      player_name_list[i] ))

    and if player_name_list happens to be {"fribble","sinJin","Sinjin"},
    you lose.

    Try
      @program foo_utils:member
      elt = args[1];
      lst = args[2];
      j = 0;
      while ( (i=elt in lst) && strcmp(elt, lst[i]) != 0)
        j = j + i;
        lst[1..i]={};
      endwhile
      return i ? j + i | 0;

    On second thought, just upgrade.  :-)

     - - - - - - - - -
    Random style peeve #227:

      !strcmp(x,y)

    is something that will get you shot in certain parts of the world
    (Hint: are we comparing for x == y or x != y?  Hard to tell, no?)

      strcmp(x,y) == 0

    uses exactly the same number of ticks and has the advantage of
    looking a lot more like an equality test (which it is)

- Prev: Re: Case (in)sensitivity
- Next: chr() & asc() patches?
- Index: MOO-cows
- Thread: MOO-cows

Home | Subject Index | Thread Index