BuildcordDocs

Manipulate text

Run a function on some text or a list, and keep the result.

data.text changes text with a function and saves the result for this run. It can't fail.

Settings

SettingWhat it does
TextThe input, such as {option.name}.
FunctionWhat to do. See the tables.
WithThe function's argument, when it takes one.
Save asThe name to keep the result under. The default is result.

Text

FunctionWhat it doesWith holds
Uppercase, Lowercase, Capitalise, Title caseChanges the case. Title case capitalises every word.Nothing
TrimRemoves spaces from both ends.Nothing
ReplaceReplaces text.from,to
SliceKeeps part of the text.start,end
TruncateCuts it to a length, ending with ….The most characters
Pad the start, Pad the endFills it out to a width: 7 becomes 007.width,character. A number is padded with zeros unless you say.
SplitSplits into a list.The separator
Length, Word countCounts characters, or words.Nothing
ReverseReverses the text.Nothing
RepeatRepeats the text.How many times
Pull out a patternKeeps the first match of a regular expression, or its first group: order #(\d+) gives the number.The pattern
Remove a patternRemoves every match.The pattern
Encode for an addressMakes text safe to put in a URL.Nothing

Numbers and time

FunctionWhat it doesWith holds
Format a numberSeparates thousands: 1234567.8 is 1,234,567.8.Decimal places, or short for 1.2M
Draw as a barDraws a fraction from 0 to 1 as blocks.How many blocks wide
Read as a length of timeTurns text such as "2d 6h" into seconds, or nothing if it can't be read.Nothing

Lists

A list is separated by commas, or by lines when it has more than one line.

FunctionWhat it doesWith holds
Count the items in a listCounts items, blanks left out.newline to count lines instead of commas
Item of a listOne item, by position.From 1, or from -1 for the last
Sort a listSorts it, numbers as numbers.desc for largest first
Drop repeats from a listKeeps the first of each, ignoring capitals.Nothing
Shuffle a listPuts it in a random order.Nothing
Join a listJoins the items with something between.What goes between, or newline

Ways out

out.

Produces

{temp.name}, using the name from Save as.

Example

Show a leaderboard's score with separators: Format a number on {row.score} with 0.

On this page