in reply to Re: Checking for occurrence in comma separated string
in thread Checking for occurrence in comma separated string

Thanks Bart, I think your right. I was hoping on a simple if compairson method without using arrays etc, but it appears that the array method is the method I should be using for this.

Thanks...
  • Comment on Re^2: Checking for occurrence in comma separated string

Replies are listed 'Best First'.
Re^3: Checking for occurrence in comma separated string
by bart (Canon) on Oct 25, 2005 at 11:28 UTC
    You can also prepend and append a comma to your strings, and use index to quickly search for it. It may likely be faster than a dynamically built regexp.
    if(index(",$thestring,", ",$thecheck,") >= 0) { ... }
    That will search for ",13," inside the string ",13,130,213,".