lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


On Tue, Dec 16, 2008 at 1:33 PM,  <adimurthy.sriramulu@wipro.com> wrote:
>
> Hi,
>
> I am using the function string.find(string.sub("12 N Y",1,2),slot) in my
> design.
>
> Where slot has values 1 to 14. However,when comparing the slot value
> with the output of "string.sub"< string.sub("12 N Y",1,2) >,i am getting
> the positive response for slot =1,2,12. My requirement is: string.find
> function must return TRUE only when slot number is equal to the output
> of string.sub function,ie slot=12 and output of string.sub is 12".
>
> Please check the output response of the above scenario :
>
>        slot            string.sub              Response
>        ----            ----------              --------
>          1                12                      1
>          2                12                      2
>        3            12                    0
>        4                  12                      0
>
>        11           12                0
>        12           12                1
>        13           12                0
>        14           12                0
>
> Is there any alternate way to achieve the same?
>
>
> Pls throw some pointers on this.
>

I'm not sure I understand exactly what you're trying to do. But don't
you simply want to check: slot == string.sub("12 N Y", 1, 2) ?
In other words, string.find() isn't what you want.

Matthew.