Skip to content

melon.char

garryspins edited this page Feb 27, 2026 · 4 revisions

melon.char


shared link

Contains useful functions for matching characters against sets of characters efficiently
melon

Functions

melon.char.IsAlpha

shared link
melon.char.IsAlpha(char) -> bool

Argument and Return information

Arguments

# Name Type Description
1 char char The character to check

Returns

# Name Type Description
1 bool bool Is this character in the given set

Is the given character an Alphabetic character

melon.char.IsAlphaNumeric

shared link
melon.char.IsAlphaNumeric(char) -> bool

Argument and Return information

Arguments

# Name Type Description
1 char char The character to check

Returns

# Name Type Description
1 bool bool Is this character in the given set

Is the given character an AlphaNumeric character

melon.char.IsHex

shared link
melon.char.IsHex(char) -> bool

Argument and Return information

Arguments

# Name Type Description
1 char char The character to check

Returns

# Name Type Description
1 bool bool Is this character in the given set

Is the given character a hexadecimal character, (0-9, a-f, A-F)

melon.char.IsKeyboardSymbol

shared link
melon.char.IsKeyboardSymbol(char) -> bool

Argument and Return information

Arguments

# Name Type Description
1 char char The character to check

Returns

# Name Type Description
1 bool bool Is this character in the given set

Is the given character a "keyboard symbol", aka any character enterable through a standard US keyboard

melon.char.IsLower

shared link
melon.char.IsLower(char) -> bool

Argument and Return information

Arguments

# Name Type Description
1 char char The character to check

Returns

# Name Type Description
1 bool bool Is this character in the given set

Is the given character an Alphabetical Lower-Case

melon.char.IsNum

shared link
melon.char.IsNum(char) -> bool

Argument and Return information

Arguments

# Name Type Description
1 char char The character to check

Returns

# Name Type Description
1 bool bool Is this character in the given set

Is the given character a Numeric character

melon.char.IsUpper

shared link
melon.char.IsUpper(char) -> bool

Argument and Return information

Arguments

# Name Type Description
1 char char The character to check

Returns

# Name Type Description
1 bool bool Is this character in the given set

Is the given character an Alphabetical Upper-Case

melon.char.IsWhitespace

shared link
melon.char.IsWhitespace(char) -> bool

Argument and Return information

Arguments

# Name Type Description
1 char char The character to check

Returns

# Name Type Description
1 bool bool Is this character in the given set

Is the given character a whitespace character

melon.char.Range

shared link
melon.char.Range(from: char, to: char) -> fn(from: char) -> bool

Argument and Return information

Arguments

# Name Type Description
1 from char The starting character
2 to char The ending character

Returns

# Name Type Description
1 match fn(from: char) -> bool The generated function

Creates a new function that checks if the given char is within the two given codepoints inclusively

melon.char.Ranges

shared link
melon.char.Ranges(ranges: table<fn(ranges: char)>, intersects?: bool) -> fn(ranges: char) -> bool

Argument and Return information

Arguments

# Name Type Description
1 ranges table<fn(ranges: char)> Table of functions to check against
2 intersects? bool Should the checking requirement match only if its in all ranges

Returns

# Name Type Description
1 match fn(ranges: char) -> bool The generated function
Creates a new function that checks if the given character is in the given ranges If intersects is true, checks if its in all ranges

melon.char.Set

shared link
melon.char.Set(chars: char...) -> fn(chars: char) -> bool

Argument and Return information

Arguments

# Name Type Description
1 chars char... All specific characters to match against

Returns

# Name Type Description
1 match fn(chars: char) -> bool The generated function

Creates a new function that checks against the given characters

Clone this wiki locally