[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
Wed Jul 28 17:56:14 CDT 2010



> On 2010-07-27 23:17:40, Tilghman Lesher wrote:
> > trunk/CHANGES, line 241
> > <https://reviewboard.asterisk.org/r/810/diff/1/?file=11937#file11937line241>
> >
> >     Add parentheses to this, as in the two previous items.

Done.


> On 2010-07-27 23:17:40, Tilghman Lesher wrote:
> > trunk/funcs/func_strings.c, lines 74-79
> > <https://reviewboard.asterisk.org/r/810/diff/1/?file=11938#file11938line74>
> >
> >     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>.

Done.


> On 2010-07-27 23:17:40, Tilghman Lesher wrote:
> > trunk/funcs/func_strings.c, line 66
> > <https://reviewboard.asterisk.org/r/810/diff/1/?file=11938#file11938line66>
> >
> >     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.

Changed it here to mention the 1-based offset.


- gareth


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


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