Re: AddStringField() or InsertString()

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: AddStringField() or InsertString()

Post by Kwai chang caine »

Hello FRED !!! :D

No no ...that's not talking about GIF :shock:

I have run, i have run,
Image
and hope i not come too late for the 5.40 :mrgreen: :lol:

Code: Select all

Procedure.s AddStringField(Sentence.s, Index, Separator.s, Text.s)
  
 MaxSeparator = CountString(Sentence, Separator)
  
 For a = 1 To MaxSeparator + 1
  
  If a <> Index
   Temp$ + StringField(Sentence, a, Separator) + Separator
  Else
   Temp$ + Text + Separator
  EndIf
  
 Next
 
 ProcedureReturn Temp$
 
EndProcedure

Debug AddStringField("Hello it's a good day for asking a new function to FRED", 3, " ", "ADDED")
Thanks for all your great job 8)
Last edited by Kwai chang caine on Wed Aug 19, 2015 9:46 pm, edited 2 times in total.
ImageThe happiness is a road...
Not a destination
User avatar
Thunder93
Addict
Addict
Posts: 1788
Joined: Tue Mar 21, 2006 12:31 am
Location: Canada

Re: AddStringField()

Post by Thunder93 »

InsertString() should of had this ability. :wink:
ʽʽSuccess is almost totally dependent upon drive and persistence. The extra energy required to make another effort or try another approach is the secret of winning.ʾʾ --Dennis Waitley
User avatar
Kwai chang caine
Always Here
Always Here
Posts: 5494
Joined: Sun Nov 05, 2006 11:42 pm
Location: Lyon - France

Re: AddStringField()

Post by Kwai chang caine »

Hello thunder93 :D

Why not :wink:
The most important is the function no 8)

And again for InsertString i see better a function who insert a string at a special place
Like that

Code: Select all

InsertString (Sentence.s, StringToInsert.s, position)

InsertString (Thunder93Kcc, 9, " and ")

Result
Thunder93 and Kcc
Have a good night
ImageThe happiness is a road...
Not a destination
Post Reply