Raised This Month: $32 Target: $400
 8% 

Solved contain & containi


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 12-19-2017 , 12:18   contain & containi
Reply With Quote #1

Can somebody give me more details about containi? I cannot understand it properly.
The code isn't helping me to much(craziness)
PHP Code:
static cell AMX_NATIVE_CALL contain(AMX *amxcell *params/* 2 param */
{
    
register cell *get_amxaddr(amxparams[2]);
    
register cell *get_amxaddr(amxparams[1]);
    
register cell *b;
    
cellstr b;
    
cellsubstr a;
    
    while (*
c)
    {
        if (*
== *a)
        {
            
c++;
            if (!*++
a)
                return 
str;
        } else {
            
= ++b;
            
substr;
        }
    }
    
    return -
1;
}

static 
cell AMX_NATIVE_CALL containi(AMX *amxcell *params/* 2 param */
{
    
register cell *get_amxaddr(amxparams[2]);
    
register cell *get_amxaddr(amxparams[1]);
    
register cell *b;
    
cellstr b;
    
cellsubstr a;
    
    while (*
c)
    {
        if (
tolower(*c) == tolower(*a))
        {
            
c++;
            if (!*++
a)
                return 
str;
        } else {
            
= ++b;
            
substr;
        }
    }
    
    return -
1;

__________________

Last edited by Relaxing; 12-20-2017 at 00:53.
Relaxing is offline
HamletEagle
AMX Mod X Plugin Approver
Join Date: Sep 2013
Location: Romania
Old 12-19-2017 , 12:44   Re: contain & containi
Reply With Quote #2

What exactly you want to know?
__________________
HamletEagle is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 12-19-2017 , 13:11   Re: contain & containi
Reply With Quote #3

Ti be honest, I want to know everything about it.
I use contain to check wether 'a' string is found inside 'b' string and thats great.
But what about containi? What's case ignoring? I'm a bit confused about this.
Do contain and containi has same functions? Well it seems so, but what's the difference between them?
Can you show a simple code using containi?
__________________
Relaxing is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 12-19-2017 , 13:29   Re: contain & containi
Reply With Quote #4

Quote:
Originally Posted by Relaxing View Post
Ti be honest, I want to know everything about it.
I use contain to check wether 'a' string is found inside 'b' string and thats great.
But what about containi? What's case ignoring? I'm a bit confused about this.
Do contain and containi has same functions? Well it seems so, but what's the difference between them?
Can you show a simple code using containi?
Case-insensitive means that for example 'a' and 'A' are equal when searching through the string.
__________________
klippy is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 12-19-2017 , 13:31   Re: contain & containi
Reply With Quote #5

case ignoring means that with contain "LOL" isnt inside of "lol" and with containi "LOL" is inside of "lol". Also contain is faster.
__________________
retired chump

Last edited by DjSoftero; 12-19-2017 at 13:32. Reason: means*
DjSoftero is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 12-19-2017 , 17:12   Re: contain & containi
Reply With Quote #6

Does that statement stays true for equali, "NAME" is equal to "name"?
__________________
Relaxing is offline
klippy
AlliedModders Donor
Join Date: May 2013
Location: Serbia
Old 12-19-2017 , 17:16   Re: contain & containi
Reply With Quote #7

Quote:
Originally Posted by Relaxing View Post
Does that statement stays true for equali, "NAME" is equal to "name"?
Wherever it says that the comparison is case-insensitive that stays true. It means that the comparison is insensitive to letter case (i.e. letter case is ignored).
__________________

Last edited by klippy; 12-19-2017 at 17:17.
klippy is offline
DjSoftero
Veteran Member
Join Date: Nov 2014
Location: Lithuania
Old 12-19-2017 , 17:25   Re: contain & containi
Reply With Quote #8

Quote:
Originally Posted by Relaxing View Post
Does that statement stays true for equali, "NAME" is equal to "name"?
equali("NAME", "naMe") == true
equal("NAME", "naMe") == false
equal("NAME", "NAME") == true
equali("NAME", "NAME") == true
__________________
retired chump
DjSoftero is offline
Relaxing
AlliedModders Donor
Join Date: Jun 2016
Location: White Plains
Old 12-20-2017 , 00:54   Re: contain & containi
Reply With Quote #9

Thank y'all for your help. Marking the thread topic as Solved
__________________
Relaxing is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 19:25.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode