Skip to content
BlidDev edited this page Jan 9, 2024 · 3 revisions

Overview:

Out of the gate, Niv comes with some basic string manipulation commands.


stolist

usage example:

// template
stolist val

// specific use
print "{}\n" (stolist "hello mother")

Args:

  • val: STR or CHAR

Desc:

Takes a STR/CHAR val and converts it into a list of CHARs.

Return value: LIST.

For more complex examples check str.nst


ltostr

usage example:

// template
ltostr lst

// specific use
print "{}\n" (ltostr (stolist "hello mother"))

Args:

  • lst: LIST of CHARs

Desc:

Takes the LIST value contained inside lst and converts it into a string.

Return value: STR.

For more complex examples check str.nst


lines

usage example:

// template
lines val

// specific use
print "{}\n" (lines "hello   \n there")

Args:

  • val: STR

Desc:

Splits a given STR val by newline characters and returns it as a LIST of STRs.

Return value: LIST.

For more complex examples check str.nst


words

usage example:

// template
words val

// specific use
print "{}\n" (words "hello   \"th ere\"")

Args:

  • val: STR

Desc:

Splits a given STR val by whitespace characters (but also preserving text in quotes) and returns it as a LIST of STRs.

Return value: LIST.

For more complex examples check str.nst


s_words

usage example:

// template
s_words val

// specific use
print "{}\n" (s_words "hello  (fj  fd) \"th ere\"")

Args:

  • val: STR

Desc:

Same as words but also preserves text inside brackets.

Return value: LIST.

For more complex examples check str.nst


trim

usage example:

// template
trim val

// specific use
print "{}\n" (dbg (trim "\thello there    \n  "))

Args:

  • val: STR

Desc:

Trims whitespace characters off the start and end of a STR conatined inside val, and returns the trimmed STR.

Return value: STR.

For more complex examples check str.nst

Clone this wiki locally