View Single Post
Old 01-25-2022, 06:05 PM   #4
chaley
Grand Sorcerer
chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.chaley ought to be getting tired of karma fortunes by now.
 
Posts: 12,354
Karma: 8012652
Join Date: Jan 2010
Location: Notts, England
Device: Kobo Libra 2
Quote:
Originally Posted by rdyornot View Post
I've looked through it several times, read through it and tried various searches - it never specifies valid characters for separators. It also doesn't seem to have come up in the forums before.
The syntax of Single Function Mode, which you are using, is extremely basic. There is no such thing as a string. Spaces are not ignored. Commas are sometimes ignored. As the documentation says:
Quote:
Important: If you have programming experience, please note that the syntax in Single Function Mode is not what you expect. Strings are not quoted and spaces are significant. All arguments are considered to be constants; there are no expressions.
You should use either Template Program Mode or General Program Mode. Both use a traditional syntax that separates strings from characters in the program. TPM's syntax is more constrained because it must live inside template snippets.

As for list separators, that is up to you. Any string can be used as a separator in the Template or General Program modes. Calibre uses both comma and ampersand, depending on the data. In some cases it uses a colon, for example in identifiers. You seem to want to split a space-separated phrase into words, which is possible in the more general modes but isn't something calibre does with its standard data types.

Last edited by chaley; 01-25-2022 at 06:14 PM. Reason: missing word
chaley is offline   Reply With Quote