Loading ...
Sorry, an error occurred while loading the content.

Re: [PBML] How do you ignore case

Expand Messages
  • Dave Gray
    ... You re misunderstanding Jeff s solution. He normalizes the input by converting Jeff or jEFF to all upper- or lower-case before comparing it to jeff
    Message 1 of 7 , Sep 3 9:09 AM
    • 0 Attachment
      > >If you want to see if it *is* a certain word, case-insensitive, do:
      > >
      > > if (lc($word) eq "jeff") { ... }
      > >or
      > > if (uc($word) eq "JEFF") { ... }
      > >
      > >If you want to see if it CONTAINS the word, do the same thing, but with
      > >index():
      > >
      > > if (index(lc $string, "jeff") > -1) { ... }
      > >or
      > > if (index(uc $string, "JEFF") > -1) { ... }
      > >
      > Regex would be better solution if you want to catch "Jeff" or "jEFF" too.

      You're misunderstanding Jeff's solution. He normalizes the input by
      converting "Jeff" or "jEFF" to all upper- or lower-case before
      comparing it to "jeff" or "JEFF" which is a perfectly good solution,
      and a matter of personal taste (vs. regex) as long as speed is not a
      critical factor.
    Your message has been successfully submitted and would be delivered to recipients shortly.