Description: The documentation for Basic function "InStr" says "To avoid a run-time error, do not set the Compare parameter if the first return parameter is omitted." What does "return parameter" refer to here? Probably the wording should be clarified to give the parameter's name (is it 'Start' ?) and not say "return" unless the parameter is passed by value. Note: None of the parameters are documented to return anything, although they are passed by reference (since not declared 'ByVal'). Steps to Reproduce: 1. Search for "InStr" in the Help Actual Results: . Expected Results: . Reproducible: Always User Profile Reset: No Additional Info:
Typo, meant "unless the parameter is passed by reference"
While fixing this, there are a couple of other improvements which could be made: * Mention whether the first position of a string is 1 or 0. * Show the result from the code example (currently it just lists the code without saying what the expected result is).
In the example of the Help page on InStr, if we ommit Start and define Compare, we get an error. E.g. iPos = Instr(sInput,"c",0) Thus I think the word "return" is misleading and should be removed.
(In reply to Jim Avera from comment #2) > While fixing this, there are a couple of other improvements which could be > made: > > * Mention whether the first position of a string is 1 or 0. Wrong. For the same example, iPos = Instr(4,"Office","f",0) the result is 0 because the search starts at position 4 and 'f' occurs at 2 and 3. IOW, it will search 'f' in string 'ice'. > > * Show the result from the code example (currently it just lists the code > without saying what the expected result is). Agree.
correction, string "ce".
for reference https://help.libreoffice.org/latest/fr/text/sbasic/shared/03120401.html
apparently the compare parameter is rounded to int, and any non-zero value is considered case insensitive. Instr(1, "LibreOffice Calc", "o", 0.4) ' return 0 Instr(1, "LibreOffice Calc", "o", -0.5) ' return 6 see also transliteration "feature" in tdf#148650.
see also https://ask.libreoffice.org/t/basic-instr-runtime-error/109437
Pierre F committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/help/commit/dc7a2b091a7652d4907391f8e39262b65ae6c780 clarify Instr(). tdf#129436, tdf#139840