[Implemented] PB constant for Replace/RemoveString()

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Demivec
Addict
Addict
Posts: 4260
Joined: Mon Jul 25, 2005 3:51 pm
Location: Utah, USA

[Implemented] PB constant for Replace/RemoveString()

Post by Demivec »

The ReplaceString() and RemoveString() commands in the string library have PB constants defined for the non-default search mode to be used. They don't however have a constant for the default mode, nor is this value defined in the help file. The constant is needed to use the default search mode when a StartPosition is also specified with these commands.
IdeasVacuum
Always Here
Always Here
Posts: 6426
Joined: Fri Oct 23, 2009 2:33 am
Location: Wales, UK
Contact:

Re: PB constant for default mode used for Replace/RemoveStri

Post by IdeasVacuum »

Try ReplaceString(sgMacFileString,sFind,sReplace,0,1)

Related to:
http://www.purebasic.fr/english/viewtop ... =4&t=43418
IdeasVacuum
If it sounds simple, you have not grasped the complexity.
Little John
Addict
Addict
Posts: 4779
Joined: Thu Jun 07, 2007 3:25 pm
Location: Berlin, Germany

Re: PB constant for default mode used for Replace/RemoveStri

Post by Little John »

IdeasVacuum wrote:Try ReplaceString(sgMacFileString,sFind,sReplace,0,1)
If this is the correct value for case sensitive search, then it will be a workaround ... but no satisfying solution.
The advantage of named constants is, that we do not have to deal with "magic numbers". That's the reason why a constant such as #PB_String_NoCase does exist. So it's a matter of course, that a named constant say #PB_String_Case will be of our advantage as well.

Regards, Little John
Seymour Clufley
Addict
Addict
Posts: 1264
Joined: Wed Feb 28, 2007 9:13 am
Location: London

Re: PB constant for default mode used for Replace/RemoveStri

Post by Seymour Clufley »

I agree. It's often puzzled me that there isn't a constant for this.
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."
Post Reply