[asterisk-dev] [Code Review] Add FIELDNUM() function which returns the position number of a field in a list.
Tilghman Lesher
tlesher at digium.com
Tue Jul 27 23:17:40 CDT 2010
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/810/#review2480
-----------------------------------------------------------
Ship it!
Make these simple documentation changes, and then it's ready to go! Excellent work.
trunk/CHANGES
<https://reviewboard.asterisk.org/r/810/#comment5472>
Add parentheses to this, as in the two previous items.
trunk/funcs/func_strings.c
<https://reviewboard.asterisk.org/r/810/#comment5473>
Please state here (or in the description) that the return value is a 1-based offset (as opposed to 0-based) and that 0 denotes that the value was not found.
trunk/funcs/func_strings.c
<https://reviewboard.asterisk.org/r/810/#comment5474>
While this section contains notes about the usage, it does not contain the actual description of the function, which should be something along the lines of:
Search the variable named <replaceable>varname</replaceable> for the string <replaceable>value</replaceable> and return a 1-based offset as to its location. If not found, return <literal>0</literal>.
- Tilghman
On 2010-07-27 21:12:44, gareth wrote:
>
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviewboard.asterisk.org/r/810/
> -----------------------------------------------------------
>
> (Updated 2010-07-27 21:12:44)
>
>
> Review request for Asterisk Developers and Tilghman Lesher.
>
>
> 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
> -----
>
> trunk/CHANGES 279754
> trunk/funcs/func_strings.c 279754
>
> 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