Skip to content

String functions

Inferno edited this page Jan 3, 2023 · 6 revisions

These are the functions that take in sequences of characters (strings) in as input.

choosechar

Chooses a random character from a string.

[CHOOSECHAR (characters: string)]

Example code:

[CHOOSECHAR "abcdefgh12345"]
> h

[LOOP 10 [CHOOSECHAR "abcdefgh12345"]]
> ['1', 'e', '4', 'd', 'c', 'g', 'g', 'e', 'h', 'f']

concat

Puts one or more strings together.

[CONCAT (string1: string) (string2: string...)]

Example code:

[CONCAT "ja" "ja"]
> jaja

[CONCAT "ja" "ja" "ja"]
> jajaja

j

Objectively the best command. Outputs "j" as many times as the number you send next.

[J (amount: int (1-250))]

Example code:

[J 3]
> jjj

length

Tells you the length of a specified string.

[LENGTH (base: string)]

Example code:

[LENGTH "jjj"]
> 3

repeat

Repeats the given string the specified amount of times.

[REPEAT (base: string) (times: integer)]

Example code:

[REPEAT "abc" 2]
> abcabc

replace

Replaces a string within a given string with another string.
Replaces all instances at once, not just the first one.

[REPLACE (base: string) (replace: string) (replace with: string)]

[REPLACE "please send help I am locked in Infernos basement" "please send help" "yay"]
> yay I am locked in Infernos basement

slice

Sends the portion of a string in between the two specified character positions, or cuts an array between the two indexes.
Does not include the end character.

[SLICE (base: string) (start: int) (stop: int) (step: int)]

[SLICE "abcdefghijk" 2 5 2]

> ceg

Clone this wiki locally