[][src]Module hatter::builtin

Hatter comes with a few built-in functions to help make your life easier, all defined in this module.

Functions

add

+ operator: add two numbers.

and

Special: Short-circuiting && operator.

concat

Combine several Values into a String. Used internally by String interpolation.

contains_

Does the string contain a substring? contains?("Mr Rogers", "Mr") #=> true

count

Count occurences of substring in string. count("Mr Rogers", "r") #=> 2

div

/ operator: divide one number by another.

empty_

True if the length of a Map, List, or String is 0.

eq

== operator: check if two Values are equal.

gt

> operator: check if a number is greater than another.

gte

>= operator: check if a number is greater than or equal to another.

index

. operator and [] operator Look up a List item by number or a Map item by key. Returns None or the Value.

len

Get the length of a Map, List, or String. Returns 0 for all other values.

lt

< operator: check if a number is less than another.

lte

<= operator: check if a number is less than or equal to another.

mod

% operator: find the remainder of dividing one number by anohter.

mul

* operator: multiply two numbers.

neq

!= operator: check if two Values are not equal.

not

! operator: return the opposite Bool of a Value

or

Special: Short-circuiting || operator.

pop

Remove the last Value from a List. Modifies the List.

print

Print one or more Values, without newline.

push

Add a Value to a List. Modifies the List.

puts

Print one or more Values, wit newlines.

range

.. operator

range_inclusive

..= operator

replace

Find and replace all matches in a target string.

split

Split a string into a List by a separator. split("Mr Rogers", " ") #=> ["Mr", "Rogers"]`

sub

- operator: subtract one number from another.

to_lowercase

Rust's String::to_lowercase(&self)

to_uppercase

Rust's String::to_uppercase(&self)

type

Returns the String name of a Value's type.

when

Returns a Value if a condition is true. Used internally by tag attributes.