View Single Post
  #3  
Old 06-10-2009, 07:11 PM
[email protected] sid.gottlieb@googlemail.com is offline
Banned
Join Date: Mar 2008
Posts: 861
sid.gottlieb@googlemail.com will become famous soon enough
HTML Code:
function onCreateds() {
  temp.arr = {"test", "foo", "test"};
  
  temp.list = {
    {"test", "test", "foo"}, "string a",
    {"test", "test", "foos"}, "string b",
    {"test", "testa", "foo"}, "string c",
    {"foo", "test", "test"}, "string d",
    {"test", "teste"}, "string e"
  };
  
    //Let's first match the sizes
  temp.size = temp.arr.size();
  
  for (temp.i: temp.list) {
      //If it's a totally different size, ignore it
    if (temp.size != temp.i.size()) continue;

      //Now let's clear it the counter
    temp.count = 0;

    for (temp.e: temp.i) {
        //If it's in the list, let's increase the counter
      if (temp.e in temp.arr) temp.count++;
    }

      //If it's the same amount let's add to the list
    if (temp.count == temp.size) {
      //Now, let's find the index and increase it
      temp.found.add(temp.list[temp.list.index(@ temp.i) + 1]);
    }
  }
  
  return temp.found;
}
This returns "string a","string d"
Reply With Quote