LibreCalc 的 StarBasic 宏中的行代码中断“_”在带引号的字符串中不起作用

Line Code break " _" in StarBasic Macros of LibreCalc do not work in quoted string

LibreCalc 的 StarBasic 宏中的行代码中断“_”在带引号的字符串中不起作用

那么如何在引号中转义行继续符“_”?

例如

Const SCells = "B17:C28,E17:G28,L17:O28,T17:V28,AA17:AE28,AN17:AR28, _
BB17:BD28,BO17:BS28,BY17:CB28,CG17:CI28,CS17:CW28,DB17:DF28,DL17:DN28, _
DU17:DX28,EF17:EK28,ET17:EV28,FA17:FD28,FJ17:FL28,FV17:FZ28,GD17:GF28, _
GM17:GO28"
splitCells = Split(SCells,",")

sub Cells_range

for i = 0 to 2 step 1

print splitCells(i)

next i

end sub

我发现在 LibreCalc 中的 starbasic 宏中的字符串中:

  • 然后你必须结束引号
  • 用换行符 starbasic 换行 / vba space-下划线字符“_”
  • 然后使用“&”连接字符串
  • 所有断线的开头和结尾都必须用引号引起来。

例如

Const SCells = "B17:C28,E17:G28,L17:O28," _
         & "BB17:BD28,BO17:BS28," _
         & "BY17:CB28,CG17:CI28,CS17:CW28"

      print SCells
      

是的,正确的句法是

Const SCells = "B17:C28,E17:G28,L17:O28,T17:V28,AA17:AE28,AN17:AR28," & _
    "BB17:BD28,BO17:BS28,BY17:CB28,CG17:CI28,CS17:CW28,DB17:DF28,DL17:DN28," & _
    "DU17:DX28,EF17:EK28,ET17:EV28,FA17:FD28,FJ17:FL28,FV17:FZ28,GD17:GF28," & _
    "GM17:GO28"

Sub  Cells_range
    splitCells = Split(SCells,","), etc.

注意-splitCells = ...的计算写在程序里面