Tell me what you want, What you really, really want.

Moderator: Mmiscool

User avatar
By Electroguard
#45362 I don't know if this would be practical to implement or not, but if instr() could take a 3rd parameter as its (optional ?) 'start' location within the main string it could offer a simple way to parse through the string for multiple occurances of demiliters such as "," and "." (for IP addresses) etc?
User avatar
By cicciocb
#45363 Hi,
there is the function 'word()' that can help you for that.
Mike (MMISCOOL) put this function recently for that.

Anyway I think that the start parameter can be done.
I was thinking also a instrrev() like in VB to search from the end.
User avatar
By Electroguard
#45366 I don't know VB, but I get the idea.

Hey, rather than mess with instr(), why not create a similar PARSE(string, delimiter, occurance) function that would be almost the same, but the third parameter OCCURANCE could also be a negative number, therefore allowing parsing the string from either direction for the appropriate occurance of the delimiter rather than its relative location?

B.T.W. It might be worth adding a note for right() in the Lang Ref just to explain that the start number is counting from the end and not the beginning - cos that's taken me quite a while to figure out.
User avatar
By Electroguard
#45368 I'm glad you pointed out Mikes handy word() function, cos it could greatly simplify some things.
Next time someone is updating the Lang Ref it would probably be worth updating the word() explanation from "Will return the unique id of the chip." to something like "Will return a whole word from its specified position in the string."