Page 1 of 1

Posted: Mon May 13, 2002 12:06 pm
by BackupUser
Restored from previous forum. Originally posted by Fangbeast.

Hi Fred, could you add a flag to ReplaceString to allow replacement of ALL occurences in a string, not just the default ANY, which I assume would be the first possible match?

Regards (you did say you wanted more suggestions) :)

Fangles

Posted: Mon May 13, 2002 5:16 pm
by BackupUser
Restored from previous forum. Originally posted by fred.

ReplaceString() already work like that no ?

Fred - AlphaSND

Posted: Tue May 14, 2002 12:08 am
by BackupUser
Restored from previous forum. Originally posted by Fangbeast.
Hi Fred, could you add a flag to ReplaceString to allow replacement of ALL occurences in a string, not just the default ANY, which I assume would be the first possible match?

Regards (you did say you wanted more suggestions) :)

Fangles
As far as I can tell, it replaces the first found occurence only but I shall do more tests after today.

Fangles

Posted: Tue May 14, 2002 1:29 am
by BackupUser
Restored from previous forum. Originally posted by PB.

> As far as I can tell, it replaces the first found occurence only

No it doesn't... try this:

Code: Select all

s$="THIS, THIS and THIS will be replaced"
Debug ReplaceString(s$,"THIS","GONE")

PB - Registered PureBasic Coder

Posted: Tue May 14, 2002 7:28 am
by BackupUser
Restored from previous forum. Originally posted by Fangbeast.
> As far as I can tell, it replaces the first found occurence only

No it doesn't... try this:

Code: Select all

s$="THIS, THIS and THIS will be replaced"
Debug ReplaceString(s$,"THIS","GONE")
PB - Registered PureBasic Coder
Yes, I finally got time to play with it and figure it out, was using my own custom routines before. ReplaceString has managed to make me slim my code down a bit.

Now, if only I could find an easy way to figure out what darned thing keeps stealing focus from my listicongadget and life would be peachy :)

Fangles