Page 1 of 1

StringField to support string delimeter

Posted: Tue Nov 03, 2009 5:34 am
by Mistrel
Currently StringField only splits based on the first character of the delimiter. It would be even more useful if it would split based on whole strings.

Re: StringField to support string delimeter

Posted: Tue Nov 03, 2009 7:43 pm
by DoubleDutch
+1

Re: StringField to support string delimeter

Posted: Tue Nov 03, 2009 9:31 pm
by akj
+1 for me also ... but ... there is an easy workaround.
Suppose you wanted the string delimiter to be the three characters " - ", then code like this will do the trick:

Code: Select all

Define string$ = "Cat - sat - on - mat"
Define temp$, i
temp$ = ReplaceString(string$, " - ", Chr(1), 1)
For i = 1 To CountString(temp$, Chr(1))+1
  Debug StringField(temp$, i, Chr(1))
Next i
End

Re: StringField to support string delimeter

Posted: Wed Nov 04, 2009 11:06 am
by Foz
+1...

But with the advent of regular expressions built into PB, it kinda becomes a moot point... though of course it would be a heck of a lot faster than regex look behinds and look aheads.