[Solved] Double and single quote for string

Creating a macro - Writing a Script - Using the API (OpenOffice Basic, Python, BeanShell, JavaScript)
Locked
luofeiyu
Posts: 53
Joined: Thu Sep 14, 2017 2:11 am

[Solved] Double and single quote for string

Post by luofeiyu »

In python ,string can be enclose by double string or single string

Code: Select all

s1 = "string"
s2 = 'string'
s1 == s2
True
I find that string can only be enclosed by double quote in oobasic.

Code: Select all

s = 'string' 
It is a wrong expression in oobasic.I can't get rules or grammar on string in oobasic.Could you give me some description on string?
Last edited by luofeiyu on Sat Feb 01, 2025 5:23 am, edited 1 time in total.
LibreOffice 7.4.7.2 on Debian 12
JeJe
Volunteer
Posts: 3064
Joined: Wed Mar 09, 2016 2:40 pm

Re: Double and single quote for string

Post by JeJe »

Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
JeJe
Volunteer
Posts: 3064
Joined: Wed Mar 09, 2016 2:40 pm

Re: Double and single quote for string

Post by JeJe »

' is used to denote a comment in Basic so can't also be used for a string. Python uses # for comments so ' can be used for strings as well as "
Windows 10, Openoffice 4.1.11, LibreOffice 7.4.0.3 (x64)
Locked