Hi Grant,
On Thu, Dec 29, 2016 at 09:12:05AM +0000, Grant Bagdasarian wrote:
Hi,
Is there a string split function built into Kamailio for use in the cfg script? I'd like to split a string of key/value pairs inside the cfg script. For example: Key1=Value1;Key2=Value2; First split on ; Then on =
Alas, there is nothing like that. Such a function would have to return an array or arraylike structure, and outside of AVPs, there are no array primitives in native Kamailio route script.
The best you can do is:
$var(i) = 0;
while(defined $(var(str){s.select,$var(i),DELIMITER})) { $var(token) = $(var(str){s.select,$var(i),DELIMITER}); $var(i) = $var(i) + 1; }
-- Alex