String

Learn about the String data type in Notion formulas.

The String data type holds and represents text content. Strings can hold nearly any character by default.

You can create a string by wrapping characters within quotation marks ". This includes numbers, “true/false”, etc. If you wrap characters in quotation marks, you’ll create a string.

"Monkey D. Luffy"

"42"

"true"
Code language: JavaScript (javascript)

Strings can be concatenated, i.e. combined. You can do so with the join function and with the add operator +:

"Monkey D. Luffy" + " will be " + "King of the Pirates!"
/* Output: Monkey D. Luffy will be King of the Pirates! */

join(["Monkey D. Luffy", "will be", "King of the Pirates!"], " ")
/* Output: Monkey D. Luffy will be King of the Pirates! */
Code language: JavaScript (javascript)

You cannot perform mathematical operations on strings. Notion does not do string-to-number conversion, so you’ll need to convert strings to numbers manually.

If a string contains nothing but a number, you can convert it using the toNumber function:

/* Invalid: Will throw an error */
add(2, "2")

/* Valid */
add(2, toNumber("2"))
Code language: JavaScript (javascript)

You can compare strings using the equal == and unequal != operators and related functions.

Good to know: Equal and unequal operators test for strict equality. In JavaScript, this would be done with the === operator.

"Monkey" == "Monkey" /* Output: true */

"Monkey" == "monkey" /* Output: false (comparison is case-sensitive) */

"Goku" != "Vegeta" /* Output: true */
Code language: JavaScript (javascript)

You can now compare strings to non-string values.

"1" == 1 /* Output: false */

"true" != true /* Output: true */
Code language: JavaScript (javascript)

Some special characters must be escaped with the backslash character \ in order to represented property in a Notion formula.

CharacterEscape Sequence
Double Quote "\"
Backslash \\\
Newline\n
Tab\t

Important notes:

  • Single quotes ' do not need to be escaped. If you wrap a string in single quotes, you’ll get an invalid character error.

Here’s a reference database that contains all of these escaped characters, which you can duplicate:

Notion – The all-in-one workspace for your notes, tasks, wikis, and databases.
A new tool that blends your everyday work apps into one. It’s the all-in-one workspace for you and your team
thomasfrank.notion.site
About the Author

My name is Thomas Frank, and I'm a Notion-certified writer, YouTuber, and template creator. I've been using Notion since 2018 to organize my personal life and to run my business and YouTube channel. In addition to this formula reference, I've created a free Notion course for beginners and several productivity-focused Notion templates. If you'd like to connect, follow me on Twitter.

🤔 Have an UB Question?

Fill out the form below and I’ll answer as soon as I can! ~Thomas

🤔 Have a Question?

Fill out the form below and I’ll answer as soon as I can! ~Thomas