[Turn off line numbering]1: arg string; 2: var children, child_names, c; 3: 4: children = .children(); 5: child_names = children.mmap('name); 6: 7: // direct matches first. 8: for c in (child_names) { 9: if (c == string) 10: return children[c in child_names]; 11: } 12: 13: // ok, try partial matches 14: for c in (child_names) { 15: if ($string.match_begin(c, string)) 16: return children[c in child_names]; 17: } 18: return 0;
// Created as a part of ColdCore, see: @help Credit