Raised This Month: $ Target: $400
 0% 

conaini counts


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Schwabba
Senior Member
Join Date: Apr 2008
Old 06-23-2011 , 09:50   conaini counts
Reply With Quote #1

Someone knows how to count how many time string A is in string B?

Example:

I made a anti-swear-plugin and added words like "low" or "affe (german for ape)", but now it blocks words like "glow" and "waffe (german for weapon)" too, so i added an ignore list looks like:

PHP Code:
            new 0
            
while ( g_swearNum_high )
            {
                if ( 
containi messagebadword_high[i++] ) != -)
                {
                    
b_found++
                }
            }
            
0
            
while ( g_swearNum_ignore )
            {
                if ( 
containi messagebadword_ignore[i++] ) != -)
                {
                    
b_ignore++
                }
            }
            if(
b_found != b_ignore)
            {
                ... 
// there is a badword found
            

But if you say the same badword more times, you can still insult like "glow you low", because it sets the variable b_found only +1 (it checks if the word "low" is inside the string and not how many times it's inside).

Someone understand that and knows how to fix it? xD
Schwabba is offline
 



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 23:23.


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