[asterisk-dev] [Code Review] Add FIELDNUM() function which returns the position number of a field in a list.

gareth at acsdata.co.nz gareth at acsdata.co.nz
Thu Jul 29 21:12:56 CDT 2010


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/810/
-----------------------------------------------------------

(Updated 2010-07-29 21:12:56.304311)


Review request for Asterisk Developers and Tilghman Lesher.


Changes
-------

FIELDNUM() will now return 0 instead of "" if given invalid arguments.


Summary
-------

Add FIELDNUM() function which returns the position number of a field in a list. Examples:

Set(LIST=apples/oranges/bananas/grapes)
${FIELDNUM(LIST,/,oranges)} => Returns '2'
${FIELDNUM(LIST,/,bananas)} => Returns '3'
${FIELDNUM(LIST,/,chicken)} => Returns '0'
${FIELDNUM(LIST,#,bananas)} => Returns '0' (Note: wrong delimiter)


This addresses bug 17713.
    https://issues.asterisk.org/view.php?id=17713


Diffs (updated)
-----

  /trunk/CHANGES 280587 
  /trunk/funcs/func_strings.c 280587 

Diff: https://reviewboard.asterisk.org/r/810/diff


Testing
-------

Performed a few tests using SetVar/GetVar via AMI. Added test function for TEST_FRAMEWORK and verified that all tests passed.


Thanks,

gareth




More information about the asterisk-dev mailing list