Text

Making text from values, and changing text. form gives text for people to read, mold text that load reads back as the same value. Strings are series too, so every series function works on them. See text.

form

The value as text for people to read.

form value
  • value (any-type!)

mold

The value as Trebol source text, the way you would type it.

mold value
  • value (any-type!)

  • /only

  • /all

reform

Reduces a block and forms it: the values with spaces between. Any other value is formed.

reform value
  • value (any value)

rejoin

Reduces a block and joins the values into one series, of the type of the first.

rejoin block
  • block (block!)

ajoin

Reduces a block and joins the values into a string, with no spaces.

ajoin block
  • block (block!)

reword

Makes a copy of a template with each keyword, marked by an escape ($ by default), replaced by its value.

reword source values
  • source (any-string!)

  • values (block! map! object!): Keywords and their values; a function value is called with the keyword

  • /case: Keywords are case-sensitive

  • /only: Uses the values of a block as they are, without reducing it

  • /escape char (char! any-string! block! none!): Marks keywords another way; char: A prefix, a [prefix suffix] block, or none for no mark

uppercase

Changes the text to capitals.

uppercase string
  • string (any-string! char!)

  • /part length (integer!)

lowercase

Changes the text to small letters.

lowercase string
  • string (any-string! char!)

  • /part length (integer!)

trim

Removes spaces at both ends, or with refinements other spaces too.

trim series
  • series (any-string! block!)

  • /head

  • /tail

  • /lines

  • /all

split

Splits a series at a delimiter, or into pieces of a size.

split series dlm
  • series (any-string! block!)

  • dlm (any-string! char! integer!)

iban?

True if the text is an IBAN (ISO 13616) of a country that has them, of that country’s length and with the right check digits. Spaces may separate its groups.

iban? text
  • text (string!)

Spaces between the groups and small letters are fine: iban? "es91 2100 0418 4502 0005 1332" is true. The country must be one that has IBANs, and the length its own. It checks that the IBAN is well made, not that the account exists.