I am writing a function in LibreOffice basic to find position of a character in a string:
REM ***** BASIC *****
Const Source = "abcdefghijklmnopwrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
Function GetPos(Char As String) As Integer
GetPos = InStr(Source, Char)
End Function
And I am calling it from spreadsheet using =GetPos("M") or =GetPos("m") from a cell in the spreadsheet. Both are returning 13.
According to the documentation, there is a parameter which is used to specify whether it should be case sensitive or not (0 or 1). If I specify the parameter, I am getting error "Action not supported. Invalid procedure call".
Any idea how to achieve search within string that is case sensitive?
PS: I am using LibreOffice vanilla Version: 5.2.3.5
Eventually I found the answer here
It appears that all optional parameters need to be passed, such as:
Instr(1, Source, Char, 0)