Text

Text prototype extensions

Import

_ <- fat.type.Text

Constructor

Name Signature Brief
Text (val: Any) Coerces value to text, same as .toText

Prototype members

Name Signature Brief
isEmpty (): Boolean Return true if length is zero
nonEmpty (): Boolean Return true if non-zero length
size (): Number Return text length
toText (): Text Force text interpolation
replace (old: Text, new: Text): Text Replace old with new
indexOf (frag: Text): Number Get fragment index, -1 if absent
contains (frag: Text): Boolean Check if text contains fragment
split (sep: Text): List/Text Split text by sep into list
toLower (): Text Return lowercase version of text
toUpper (): Text Return uppercase version of text
trim (): Text Return trimmed version of text
match (regex: Text): Boolean Return text is match for regex

Example

_ <- fat.type.Text
x = 'banana'
x.size                       # yields 6
x.replace('nana', 'nquet');  # yields 'banquet'

See also

results matching ""

    No results matching ""