[Implemented] ReplaceString: Add opt. para. [,NbOccurences]
[Implemented] ReplaceString: Add opt. para. [,NbOccurences]
String$ = ReplaceString(String$, StringToFind$, StringToReplace$ [, Mode [, StartPosition]])
I cannot say: Replace only the first occurence of a search string.
I cannot say: Replace only the first occurence of a search string.
Last edited by IceSoft on Thu Apr 15, 2010 5:41 am, edited 1 time in total.
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
Re: ReplaceString has no parameter for NbOccurences
Where is the bug ?
Re: ReplaceString has no parameter for NbOccurences
ReplaceString iterating trough the whole string...I miss the occurence parameter for stopping the iteration e.g. after the first replace
ReplaceString have also have to have the NbOccurences parameter as the RemoveString has:
Code: Select all
s1.s = "abcdeabcdeabcdeabcde"
s2.s = "ab"
Debug s1
String$ = ReplaceString(s1, s2, "AB" , #PB_String_InPlace, 1)
Debug s1 ; Result: ABcdeABcdeABcdeABcde, but I want: ABcdeabcdeabcdeabcde
Code: Select all
String$ = RemoveString(String$, StringToRemove$ [, Mode [, StartPosition [, NbOccurences]]])
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
- Arctic Fox
- Enthusiast
- Posts: 609
- Joined: Sun Dec 21, 2008 5:02 pm
- Location: Aarhus, Denmark
Re: ReplaceString has no parameter for NbOccurences
Isn't this a feature request then? 

Re: ReplaceString has no parameter for NbOccurences
Yes for all who not using ReplaceString at the moment.Arctic Fox wrote:Isn't this a feature request then?
If you use it...than it is a bug.
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
Re: ReplaceString has no parameter for NbOccurences
Please add this optional parameter. You know: it is more a wrong design as a feature wish.Rings wrote:moved....
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
Re: ReplaceString has no parameter for NbOccurences
Just because you want it doesn't make it wrong not to have it 

quidquid Latine dictum sit altum videtur
-
- Addict
- Posts: 1264
- Joined: Wed Feb 28, 2007 9:13 am
- Location: London
Re: ReplaceString has no parameter for NbOccurences
+1
JACK WEBB: "Coding in C is like sculpting a statue using only sandpaper. You can do it, but the result wouldn't be any better. So why bother? Just use the right tools and get the job done."
Re: ReplaceString has no parameter for NbOccurences
In a real programmer life I can find more examples on which you want ONLY replace one occurence.freak wrote:Just because you want it doesn't make it wrong not to have it

So my wish is:
Add a ReplaceString which is not searching through a string...a replace on a given position is enough.
For the actual implemented ReplaceString... please add the forgotten optional parameter:[, NbOccurences].
For example see RemoveString(...):
String$ = RemoveString(String$, StringToRemove$ [, Mode [, StartPosition [, NbOccurences]]])
Belive! C++ version of Puzzle of Mystralia
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...
<Wrapper>4PB, PB<game>, =QONK=, PetriDish, Movie2Image, PictureManager,...