Raised This Month: $ Target: $400
 0% 

about strings


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xfire
Member
Join Date: Apr 2010
Location: World
Old 07-27-2011 , 16:28   about strings
Reply With Quote #1

how i detect a string how many times repeating in another string
Ex
fStr "alliedmodders" sStr "l"
there are two "l" in "alliedmodders" so it returns 2 value

i searched it but i couldnt find anything
xfire is offline
Send a message via MSN to xfire Send a message via Skype™ to xfire
Old 07-27-2011, 17:21
fysiks
This message has been deleted by fysiks. Reason: nvm, sylwester did it :)
Sylwester
Veteran Member
Join Date: Oct 2006
Location: Poland
Old 07-27-2011 , 17:45   Re: about strings
Reply With Quote #3

PHP Code:
public cnt_substr(fStr[], sStr[]){
    new 
cntpostmp
    
new len strlen(sStr)
    new 
max strlen(fStr)-len+1
    
    
while(pos<max && (tmp contain(fStr[pos], sStr)) != -1){
        
pos += len+tmp
        cnt
++
    }
    return 
cnt

__________________
Impossible is Nothing
Sylwester 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 01:09.


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