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

Solved searching string inside another string


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
riste.kgb
Junior Member
Join Date: Oct 2019
Location: Macedonia, Bogdanci
Old 11-15-2019 , 05:47   searching string inside another string
Reply With Quote #1

Code:
if(strfind(data[Something], string) !== -1) {
return true;
} else {
return false;
}
It doesn't work.

Also contain, containi is not working properly. What's the point to exists these functions when they returns -1, and zero (which in if, while statements are false)

I want to search string inside another string, it can be 1 single char from that string or all strings.

equal and or equali will not work in my situation.

Code:
if(!(strfind(data[Something],string))
Will not work,because always returns 1 even if no string match
Tested it with !! too.

AMXXi is 1.8.2

Last edited by riste.kgb; 11-15-2019 at 08:19. Reason: excuse me, it was 1.8.2
riste.kgb is offline
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 11-15-2019 , 05:50   Re: searching string inside another string
Reply With Quote #2

Quote:
Originally Posted by riste.kgb View Post
Also contain, containi is not working properly. What's the point to exists these functions when they returns -1, and zero (which in if, while statements are false)
Check doc before posting.
Quote:
Return
-1 on failure (no match found). Any other value
You have to check != -1 to make sure that string1 is contained somewhere inside string2.
__________________

Last edited by edon1337; 11-15-2019 at 05:52.
edon1337 is offline
riste.kgb
Junior Member
Join Date: Oct 2019
Location: Macedonia, Bogdanci
Old 11-15-2019 , 05:55   Re: searching string inside another string
Reply With Quote #3

Quote:
Originally Posted by edon1337 View Post
Check doc before posting.


You have to check != -1 to make sure that string1 is contained somewhere inside the string2.
I know, i did that again but there is bug and it is not even checking.


Again not works i even did multiple checks
Code:
if(strfind(data[something],string) != -1) || !strfind(data[something,string) || strfind(data[something],string) > 0 ) {
return true
} else {
return false
}
Second checking if the result is 0 => which is false always
riste.kgb is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 11-15-2019 , 05:55   Re: searching string inside another string
Reply With Quote #4

What ??? At least use the last amxx stable version which is 182 contain/i should return -1 on failure and greater than -1 on success
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
riste.kgb
Junior Member
Join Date: Oct 2019
Location: Macedonia, Bogdanci
Old 11-15-2019 , 05:58   Re: searching string inside another string
Reply With Quote #5

Quote:
Originally Posted by Natsheh View Post
What ??? At least use the last amxx stable version which is 182 contain/i should return -1 on failure and greater than -1 on success
I forgot it is 1.8.2 amxx version, and this is bugged.

functions:

strfind()
contain()
containi()
riste.kgb is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 11-15-2019 , 06:05   Re: searching string inside another string
Reply With Quote #6

If it is bugged it would be already fixed on v182 I had never experienced any problem using them..
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !

Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
riste.kgb
Junior Member
Join Date: Oct 2019
Location: Macedonia, Bogdanci
Old 11-15-2019 , 06:07   Re: searching string inside another string
Reply With Quote #7

Quote:
Originally Posted by Natsheh View Post
If it is bugged it would be already fixed on v182 I had never experienced any problem using them..
I experienced it right now.
riste.kgb is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 11-15-2019 , 07:24   Re: searching string inside another string
Reply With Quote #8

Please show the full code. You're obviously doing something wrong.

PHP Code:
if(strfind(wherewhat) != -1
PHP Code:
if(contain(wherewhat) != -1
PHP Code:
if(containi(wherewhat) != -1
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
riste.kgb
Junior Member
Join Date: Oct 2019
Location: Macedonia, Bogdanci
Old 11-15-2019 , 08:19   Re: searching string inside another string
Reply With Quote #9

Quote:
Originally Posted by OciXCrom View Post
Please show the full code. You're obviously doing something wrong.

PHP Code:
if(strfind(wherewhat) != -1
PHP Code:
if(contain(wherewhat) != -1
PHP Code:
if(containi(wherewhat) != -1

I've checked first how i put in array the flags then i see that it was wrong in native, i forgot to add
param_convert(5), and there it happens that bug. So now it's fixed.

It appears that is not a bug with function strfind.

I fixed this problem. Thank you guys for assisting in the thread.
riste.kgb is offline
Reply


Thread Tools
Display Modes

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 04:42.


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