[Implemented] correction for 'Mode' flag in ReplaceString()

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Psychophanta
Always Here
Always Here
Posts: 5153
Joined: Wed Jun 11, 2003 9:33 pm
Location: Anare
Contact:

[Implemented] correction for 'Mode' flag in ReplaceString()

Post by Psychophanta »

Syntax

String$ = ReplaceString(String$, StringToFind$, StringToReplace$ [, Mode [, StartPosition]])
Description

Try to find any occurrences of 'StringToFind$' in the given 'String$' and replace them with 'StringToReplace$'. An optional 'StartPosition' parameter can be specified to tell at which position the replace should start. First 'StartPosition' index is 1.

'Mode' can be a combination of the following values:
1: Case insensitive search (A=a). By default the search is case sensitive.
2: In place replacing. This means that the string is replaced directly in the memory. The 'StringToFind$' and
'StringToReplace$' parameter must have the same length ! This is a dangerous option, for advanced users only.
The advantage is the very high speed of the replacement. When using this option, the result of ReplaceString() has
to be ignored (and not affected to something, as this is the string passed in parameter which is changed).
For the 'Mode' flag should be added some like:
0: Case sensitive search (A<>a). Default value.
http://www.zeitgeistmovie.com

while (world==business) world+=mafia;
User avatar
Andre
PureBasic Team
PureBasic Team
Posts: 2137
Joined: Fri Apr 25, 2003 6:14 pm
Location: Germany (Saxony, Deutscheinsiedel)
Contact:

Post by Andre »

Done. :D
Also added an example for Mode = 2

(for next version)
Bye,
...André
(PureBasicTeam::Docs & Support - PureArea.net | Order:: PureBasic | PureVisionXP)
Post Reply