Browse code

pv: docs for xvp_slist_explode()

Daniel-Constantin Mierla authored on 14/10/2020 13:55:29
Showing 1 changed files
... ...
@@ -413,6 +413,49 @@ $xavp(x[0]=>c) = "d";
413 413
 $xavp(x[0]=>a) = "b";
414 414
 xavp_params_implode("x", "$var(out)");
415 415
 # results in: $var(out) is "a=b;c=d;e=f;"
416
+...
417
+				</programlisting>
418
+			</example>
419
+		</section>
420
+		<section id="pv.f.xavp_slist_explode">
421
+			<title>
422
+				<function moreinfo="none">xavp_slist_explode(slist, sep, mode, xname)</function>
423
+			</title>
424
+			<para>
425
+				Breaks a string list in tokens by separators and stores them
426
+				in XAVPs. Note that is not storing empty values.
427
+			</para>
428
+			<para>
429
+				The first parameter has to be a string (static or with variables).
430
+			</para>
431
+			<para>
432
+				The second parameter has to contain separator characters (they
433
+				can be many).
434
+			</para>
435
+			<para>
436
+				The third parameter is mode, controlling the behaviour of extracting
437
+				the tokens, the supported mode right now is 't', which trims
438
+				the white spaces around the value.
439
+			</para>
440
+			<para>
441
+				The fourth parameter is the name of the xavp to hold the tokens.
442
+			</para>
443
+			<para>
444
+				The values are stored as string type.
445
+			</para>
446
+			<para>
447
+			Function can be used from ANY ROUTE.
448
+			</para>
449
+			<example>
450
+				<title><function>xavp_slist_explode</function> usage</title>
451
+				<programlisting format="linespecific">
452
+...
453
+xavp_slist_explode("a=b; c=d;", "=;", "t", "x");
454
+# results in:
455
+#    $xavp(x[0]) = "a";
456
+#    $xavp(x[1]) = "b";
457
+#    $xavp(x[2]) = "c";
458
+#    $xavp(x[3]) = "d";
416 459
 ...
417 460
 				</programlisting>
418 461
 			</example>