Skip to content

melon.str

garryspins edited this page Feb 27, 2026 · 7 revisions

melon.str


shared link

Contains string analysis functions
melon

Functions

melon.str.Chars

shared link
melon.str.Chars(string) -> char, number

Argument and Return information

Arguments

# Name Type Description
1 string string Input string to iterate over

Returns

# Name Type Description
1 char char The current character
2 number number The current index

Iterates over a strings contents

melon.str.CompareSub

shared link
melon.str.CompareSub(input: string, cmp: string, index: number) -> bool

Argument and Return information

Arguments

# Name Type Description
1 input string The string to compare with
2 cmp string The string to check for
3 index number The starting index

Returns

# Name Type Description
1 bool bool Was the string found at this index

Checks if a string is within the given input string at the given index, including that index

melon.str.Split

shared link
melon.str.Split(string, delimiter: string, times?: number) -> table

Argument and Return information

Arguments

# Name Type Description
1 string string String to split
2 delimiter string Delimiter to split by
3 times? number How many times to split the string

Returns

# Name Type Description
1 split table The split string
Splits a string given an arbitrary length delimiter however many times given Providing nil to times will split infinitely

melon.str.SplitN

shared link
melon.str.SplitN(string, number) -> table

Argument and Return information

Arguments

# Name Type Description
1 string string String to split
2 number number How many chars per sub-string

Returns

# Name Type Description
1 split table Output strings

Splits the input string so N chars are in every sub-string

melon.str.SplitOnce

shared link
melon.str.SplitOnce(string, delim: string) -> string, string

Argument and Return information

Arguments

# Name Type Description
1 string string String to split
2 delim string Delimiter to split by

Returns

# Name Type Description
1 lhs string The left side of the split
2 rhs string The right side of the split

Splits a string once given the arbitrary sized delimiter

melon.str.SplitOnceX

shared link
melon.str.SplitOnceX(string, delim: string) -> string, string

Argument and Return information

Arguments

# Name Type Description
1 string string String to split
2 delim string Delimiter to split by

Returns

# Name Type Description
1 rhs string The right side of the split
2 lhs string The left side of the split
Splits a string once given the arbitrary sized delimiter Reverses the arguments so the trailing text is always first

Clone this wiki locally