Hi guysfine to learn the existence of this function from you , among the tons of other news in QB64.
before to say a silly thing I try to resume that I have understood from your talking about the right value returned by _INSTRREV when there is a problem with parameters...
1. _INSTRREV is not the simmetrical opposite of INSTR
syntax
_INSTRREV (WheretoSearch$, WhattoSearch$, UntilLastRightCharacterConsidered%,CompareMethod%)
^ ^ ^ ^
| | | | Who is it?
string in which we search | | is there In QB64 version of the function?
string to search |
Start is a BAD name for this parameter because in this function it shows the last right character of the string to consider in the searching task, but it is right the first character used because the searching comes from right to left (in this sense we can call it START) but we always read the string from left to right and count the position from the left to right!
To be simmetrical (Reverse INSTR) it would count from the start position ie from the last right character considered going to the left. But this is not the issue.
So _INSTRREV searches a string1 into a string2 starting from the right side of the string2 less the start position, going to left . The result is the position of string1 counting from the left side of string2.
If start is omitted it is -1 by default and the seaching starts from the last right character of string2.
Here my questions1. the parameter Compare% is implemented in QB64 _INSTRREV?
2. What have I missed to understand only half of the example that is here
https://www.techonthenet.com/excel/formulas/instrrev.php ?
3. what is the difference between Start = 0, Start = null and Start omitted in QB64?
If start is null, the INSTRREV function will return #Error.
4. why INSTRREV must return 0 if Start is greater StringMatch ?
StringMatch
String
Required. String expression being searched for.
Start
Int32
Optional. Numeric expression setting the one-based starting position for each search, starting from the left side of the string. If Start is omitted then -1 is used, meaning the search begins at the last character position. Search then proceeds from right to left.