padStart

Learn how to use the padStart function in Notion formulas.

The padStart() function accepts a string argument and returns that string padded by a provided padding string, until a desired final string length is reached.

padStart(string, targetLength, paddingString)
string.padStart(targetLength, paddingString)
Code language: JavaScript (javascript)

Note that targetLength is the length of the final output string, which includes the repeated paddingString and the input string.

padStart (and its counterpart, padEnd), are useful for ensuring that input strings of varying lengths conform to a single target length.

"hello".padStart(8, ".") /* Output: "...hello" */

"hello".padStart(10, ".") /* Output: ".....hello" */

"Well hello there".padStart(1, ".") /* Output: "Well hello there" (if the input string is longer than targetLength, the input string is returned alone and untruncated */
Code language: JavaScript (javascript)
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