ReplaceString only once syntax ?

Just starting out? Need help? Post your questions and find answers here.
vmars316
Enthusiast
Enthusiast
Posts: 464
Joined: Fri Jun 29, 2012 12:24 am
Contact:

ReplaceString only once syntax ?

Post by vmars316 »

Thanks ,
; String$ = ReplaceString(String$, StringToFind$, ReplacementString$ [, Mode [, StartPosition [, NbOccurrences]]])
OneHtmlLineOut$ = ReplaceString(ImageHtmlLineIn$ ,"FolderAddress" ,HoldFolderAddress$ [, [, [, 1 ]]])

OneHtmlLineOut$ = ReplaceString(ImageHtmlLineIn$ ,"FolderAddress" ,HoldFolderAddress$ , , , 1)

OneHtmlLineOut$ = ReplaceString(ImageHtmlLineIn$ ,"FolderAddress" ,HoldFolderAddress$ [, , , 1])

Pls , what is the proper syntax ?
vmars.us Win11 x64 , Martin Guitar 000-16 (1995)
"All things in moderation , except for love and forgiveness."
User avatar
StarBootics
Addict
Addict
Posts: 984
Joined: Sun Jul 07, 2013 11:35 am
Location: Canada

Re: ReplaceString only once syntax ?

Post by StarBootics »

Hello,

The square bracketed parameters means they are optional.

This is perfectly fine :

Code: Select all

OneHtmlLineOut$ = ReplaceString(ImageHtmlLineIn$ ,"FolderAddress" ,HoldFolderAddress$)
Best regards
StarBootics
The Stone Age did not end due to a shortage of stones !
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1243
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

Re: ReplaceString only once syntax ?

Post by Paul »

If you want to specify the NbOccurrences option then you must put something in the optional fields that come before it.

Code: Select all

OneHtmlLineOut$ = ReplaceString(ImageHtmlLineIn$ ,"FolderAddress" ,HoldFolderAddress$,#PB_String_NoCase,1,1)
Image Image
vmars316
Enthusiast
Enthusiast
Posts: 464
Joined: Fri Jun 29, 2012 12:24 am
Contact:

Re: ReplaceString only once syntax ?

Post by vmars316 »

Thanks ,
Hmm..
So if I use at least 1 option , I must use them all ?
vmars.us Win11 x64 , Martin Guitar 000-16 (1995)
"All things in moderation , except for love and forgiveness."
User avatar
Paul
PureBasic Expert
PureBasic Expert
Posts: 1243
Joined: Fri Apr 25, 2003 4:34 pm
Location: Canada
Contact:

Re: ReplaceString only once syntax ?

Post by Paul »

Additional options are required in order.

Example.. if you only need the 1st option the options that follow are not required.
If you need the 3rd option then you must also include the 2 options before it.
Image Image
vmars316
Enthusiast
Enthusiast
Posts: 464
Joined: Fri Jun 29, 2012 12:24 am
Contact:

Re: ReplaceString only once syntax ?

Post by vmars316 »

Thanks Paul
vmars.us Win11 x64 , Martin Guitar 000-16 (1995)
"All things in moderation , except for love and forgiveness."
Post Reply