Re: Build intersection of two comma separated lists?

Benoit Panizzon via sr-users <[email protected]>
Newsgroups gmane.comp.voip.ser
Organization ImproWare AG
Message-ID <[email protected]>
> Is there anything like an intersection function? Is there an easy way
> to build such a function with existing functionality?

I came up with this, wondering if there is a more elegant solution:

$var(i) = 0;
$var(A) = "PCMA,AMR-WB,telephone-event";
$var(B) = "G722,PCMA,G729,telephone-event";
$var(inters) = "";
$var(separator) = "";
while ($(var(A){s.select,$var(i),,}) != "") {
        if (in_list("$var(A)","$var(B)",",")) {
                $var(inters) = $var(inters) + $var(separator) + $var(A);
                $var(separator) = ",";
        }
        $var(i) = $var(i) + 1;
}
xlog("L_INFO", "$cfg(route): XXXXXXX DEBUG: INTERSECITON of $var(A) and $var(B) is $var(inters) \n");

Mit freundlichen Grüssen

-Benoît Panizzon-
-- 
I m p r o W a r e   A G    -    Leiter Commerce Kunden
______________________________________________________

Zurlindenstrasse 29             Tel  +41 61 826 93 00
CH-4133 Pratteln                Fax  +41 61 826 93 01
Schweiz                         Web  http://www.imp.ch
______________________________________________________
__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions -- [email protected]
To unsubscribe send an email to [email protected]
Important: keep the mailing list in the recipients, do not reply only to the sender!
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.