Return the last string field when passing -1 index, done in an efficient way start parsing at the end of the string
it comes handy to get fileextensions or filenames from urls
StringField("http://host.com/file.htm", -1, "/")
StringField("c:\foo\file.ext", -1, ".")
i know there are several ways for this(don't need to post code), but it seems StringField() is well suited for it
StringField(String$, -1, Delimiter$)
Re: StringField(String$, -1, Delimiter$)
I like that and would even like more if it was a bit extended.Justin wrote:Return the last string field when passing -1 index, done in an efficient way start parsing at the end of the string
it comes handy to get fileextensions or filenames from urls
StringField("http://host.com/file.htm", -1, "/")
StringField("c:\foo\file.ext", -1, ".")
i know there are several ways for this(don't need to post code), but it seems StringField() is well suited for it
Either using your syntax, giving the possibility of using also -2,-3,...,-n to get the 2nd, 3rd or whatsoever field from the right or adding an optional parameter.:
Result$ = StringField(String$, Index, Delimiter$[,Mode])
0 (default) - from left to right
1 - from right to left