The length()
function outputs a number that corresponds to the length of a string.
length(string)
Example Formulas
length("Monkey D. Luffy") // Output: 15
length("Supercalifragilisticexpialidocious") // Output: 34
length("Doctor Doom") // Output: 11
Example Database
This example database used the length()
function to return the number of characters in the Name property. It also uses an if statement to intelligently output “character” or “characters”.

View and Duplicate Database

“Characters” Property Formula
// Compressed
format(length(prop("Name"))) + " " + ((length(prop("Name")) == 1) ? "character" : "characters")
// Expanded
format(
length(prop("Name"))
) +
" " +
(
(
length(
prop("Name")
) == 1
) ?
"character" :
"characters"
)
This formula first uses the length()
function to get the number of characters in the Name property. This is wrapped in the format function in order to convert the number to a string.
Second, an if statement again uses length()
to check whether or not the number of characters in the Name property is equal to 1
. If so, it outputs the singular “character”. If not, it outputs the plural “characters.”
Other formula components used in this example:


