mmmm...i think substr requires prior knowledge of position of substring. index seems to be the correct option to me.
Please correct me if i am wrong. | [reply] |
index lets you search a string quickly for an exact match, or find an exact match after some position, or walk the string finding each exact match (by advancing the starting position each time).
substr will return a substring, which you could then programatically process and test for some condition if you want. If you want to find the first position in a string where a four character sequence looks a particular way after the digits are reversed, you might walk the string using substr, advancing the position after each check (a bad example, since it's cheaper to just reverse the whole string and then use index, subtracting four from the result).
index is a more specific function, and substr is a more general function that can be incorporated into a more specific solution.
| [reply] |
| [reply] [d/l] [select] |