Najova

DocsBuilt-in functions

Text

Join, cut, change and search text.

$join

$join[values...]

The values as one text, side by side.

join.naja
$print[$join[a;b;c]]
najova run join.naja
abc

$text

$text[value]

The value as text.

text.naja
$let[n;$text[12]]
$print[$type[$get[n]]: $get[n]]
najova run text.naja
text: 12

$upper

$upper[text]

The text in capitals.

upper.naja
$print[$upper[shout]]
najova run upper.naja
SHOUT

$lower

$lower[text]

The text in small letters.

lower.naja
$print[$lower[QUIET]]
najova run lower.naja
quiet

$trim

$trim[text]

The text without spaces and new lines at its start and end.

trim.naja
$let[typed;"   sam@mail.com  "]
$print[<$trim[$get[typed]]>]
najova run trim.naja
<sam@mail.com>

$split

$split[text] or $split[text;separator]

The text cut into a list at each separator (at spaces when none is given; "" gives each letter).

split.naja
$each[word;$split[red green blue]]
  $print[$get[word]]
$endeach
$print[$count[$split[a,b,c;,]] parts]
najova run split.naja
red
green
blue
3 parts

$replace

$replace[text;old;new]

The text with every old part changed to the new one.

replace.naja
$print[$replace[I like cats;cats;dogs]]
najova run replace.naja
I like dogs

$find

$find[text;part] or $find[list;value]

Where the part is in the text (the first letter is 1) or the value in the list; nil when it is not there. A third value says where to start.

find.naja
$print[$find[hello world;world]]
$print[$find[$list[a;b;c];c]]
$print[$find[hello;z]]
najova run find.naja
7
3
nil

$startsWith

$startsWith[text;part]

true when the text starts with the part.

startsWith.naja
$print[$startsWith[!help;!]]
najova run startsWith.naja
true

$endsWith

$endsWith[text;part]

true when the text ends with the part.

endsWith.naja
$print[$endsWith[photo.png;.png]]
najova run endsWith.naja
true

$format

$format[text;values...]

The text with {1}, {2} ... changed to the values: $format[Hi {1}, you have {2} coins;Sam;5].

format.naja
$print[$format[{1} has {2} coins;Sam;25]]
najova run format.naja
Sam has 25 coins