https://bugs.documentfoundation.org/show_bug.cgi?id=137668

            Bug ID: 137668
           Summary: Basic InStr() does not support documented 'Start'
                    argument
           Product: LibreOffice
           Version: 3.3.0 release
          Hardware: All
                OS: All
            Status: UNCONFIRMED
          Severity: normal
          Priority: medium
         Component: BASIC
          Assignee: libreoffice-bugs@lists.freedesktop.org
          Reporter: jim.av...@gmail.com

Description:
The Basic language "InStr" function is documented to have an optional initial
argument giving the starting offset for searching.  However any attempt to pass
a number for the first argument raises an "Invalid Procedure Call" function.

Seems to be inherited from OO (occurs in LO 3.3)

Either this should be fixed, OR the documentation changed to say the 'start'
argument is not supported by Libre Office.  

To save the remaining hair on programmers' heads!

Here is the current (LO 7.x) documentation for the InStr function:

«
InStr ([Start As Long,] Text1 As String, Text2 As String[, Compare])

Parameters:

Start: A numeric expression that marks the position in a string where the
search for the specified substring starts. If you omit this parameter, the
search starts at the first character of the string. The maximum allowed value
is 65535.

Text1: The string expression that you want to search.

Text2: The string expression that you want to search for.

Compare: Optional numeric expression that defines the type of comparison. The
value of this parameter can be 0 or 1. The default value of 1 specifies a text
comparison that is not case-sensitive. The value of 0 specifies a binary
comparison that is case-sensitive.

To avoid a run-time error, do not set the Compare parameter if the first return
parameter is omitted.
»

[So it must be intended to work by checking the type of the first argument to
see if it is a string or a number]


Steps to Reproduce:
1. Start LO calc
2. Tools->Macros->Organize Macros->Basic
3. Navigate to the current document (e.g. "Untitled1", create a new module, and
paste the following Basic code into the empty module:


sub bugdemo
  Dim i
  Dim start as Long
  start = 0
  i = InStr(start, "abc", "b")
  MsgBox "Succeeded, returned " & i
end sub

4. Place cursor inside the above function and click "Run" button on the toolbar

Actual Results:
Popup says "Action not supported; Invalid procedure call"

Expected Results:
Should work, or else be documented to not work.


Reproducible: Always


User Profile Reset: No



Additional Info:
.

-- 
You are receiving this mail because:
You are the assignee for the bug.
_______________________________________________
Libreoffice-bugs mailing list
Libreoffice-bugs@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-bugs

Reply via email to