This site is a testing version, but all data is shared with the live forum.


Raised This Month: $ Target: $400
 0% 

[REQ] replace_all. Return number of occurences


  
 
 
Thread Tools Display Modes
Author Message
MaximusBrood
Veteran Member
Join Date: Sep 2005
Location: The Netherlands
Old 09-09-2006 , 12:51   [REQ] replace_all. Return number of occurences
#1

Can you edit the stock so it will show how many times it replaced something?

Here's the simple fix for it:

Code:
stock replace_all(string[], len, what[], with[]) {     new withlen, charnum = 0, occurrences = 0;         withlen = strlen(with);         while (replace(string[charnum], len, what, with) != 0)     {         charnum += contain(string[charnum], with) + withlen;         occurrences++;     }     return occurrences; }
__________________
Released six formerly private plugins. Not active here since ages.
MaximusBrood is offline
BAILOPAN
Join Date: Jan 2004
Old 09-10-2006 , 01:16   Re: [REQ] replace_all. Return number of occurences
#2

This was small enough to squeeze into the next release. Added as revision 3053.
__________________
egg
BAILOPAN 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 09:03.


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