...

text

text, contextual keyword

The word text is a contextual keyword of the Envision language. It refers to the primitive data type text that contains a list of Unicode characters. Text values are capped to 256 characters in Envision.

tt = "Hello World!"
show table "" write:"/sample/onetext.ion" with tt

followed by

read "/sample/onetext.ion" as T with
  tt : text

show scalar "" a1b2 with same(T.tt)

text(a: ‘a) 🡒 text, const pure function

Returns the canonical text representation for all the primitive data types.

show summary "" a1a4 with
  text(true)
  text(123.45)
  text(date(2020, 8, 27))
  text("Hello World!") // identity

The text() function is implicitely used when interpolating text value, i.e. \{myValue}.

The text(a: 'a) 🡒 text is called implicitly when attempting to display a primitive data type.

a = true
b = 123.45
c = date(2020, 8, 27)
d = "Hello World!"

show summary "" a1a4 with 
  a // implicit 'text(a)'
  b // implicit 'text(b)'
  c // implicit 'text(c)'
  d // already 'text' value

\{ }, text interpolation

Text literals benefit for a dynamic behavior called interpolation. Interpolation is a syntactic sugar over the concatenation of text values.

a = 42
b = "bar"
c = date(2022, 2, 17)

x = "\{a} foo \{b} -- \{c}" // interpolate

show scalar "" a1b1 with x // display '42 foo bar -- 2022-02-17'

Interpolation options for dates

Dates can be formatted during the interpolation.

a = date(2022, 2, 17)
show scalar "" with "\{a:MM/dd/yyyy}" // display '02/17/2022'

The available tokens are:

Any other characters are used as in the output text value.

User Contributed Notes
0 notes + add a note