LibreOffice basic 中的 Instr 函数不区分大小写?
Instr function not case sensitive in LibreOffice basic?
我正在 LibreOffice basic 中编写一个函数来查找字符在字符串中的位置:
REM ***** BASIC *****
Const Source = "abcdefghijklmnopwrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
Function GetPos(Char As String) As Integer
GetPos = InStr(Source, Char)
End Function
我在电子表格的单元格中使用 =GetPos("M") 或 =GetPos("m") 从电子表格调用它。两者都返回 13.
根据documentation,有一个参数用于指定是否区分大小写(0 或 1)。如果我指定参数,我会收到错误 "Action not supported. Invalid procedure call".
知道如何在区分大小写的字符串中实现搜索吗?
PS:我使用的是 LibreOffice vanilla 版本:5.2.3.5
最终我找到了答案here
看来可选参数都需要传,比如:
Instr(1, Source, Char, 0)
我正在 LibreOffice basic 中编写一个函数来查找字符在字符串中的位置:
REM ***** BASIC *****
Const Source = "abcdefghijklmnopwrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
Function GetPos(Char As String) As Integer
GetPos = InStr(Source, Char)
End Function
我在电子表格的单元格中使用 =GetPos("M") 或 =GetPos("m") 从电子表格调用它。两者都返回 13.
根据documentation,有一个参数用于指定是否区分大小写(0 或 1)。如果我指定参数,我会收到错误 "Action not supported. Invalid procedure call".
知道如何在区分大小写的字符串中实现搜索吗?
PS:我使用的是 LibreOffice vanilla 版本:5.2.3.5
最终我找到了答案here
看来可选参数都需要传,比如:
Instr(1, Source, Char, 0)