Page 1 of 1

Mid() and StringField() to allow negative start positions

Posted: Fri Jul 12, 2013 6:59 am
by Neil
No big deal (and I know that I can write my own functions) but it would be handy to have the inbuilt PB functions allow negative start positions.

This would indicate that counting is to start from the end of the string.

Mid("This is a string", -2) = "ng"

Mid("This is a another string", -4, 2) = "ri"

StringField("Hello I am a splitted string", -2, " ") = "splitted"

StringField("ABC/DEF/GHJ/KLM/NOP", -2, "/ ") = "KLM"

I have seen that a similar request has been lodged for StringField() but only for using -1 as an indicator to start count from end.

I couldn't find request for Mid() and this request combines requests.