Module el.strings

A Lua module for basic string manipulation.

Provides utilities for trimming, splitting, and converting string cases.

Functions

tocamel (str) Convert a string to camel case.
tosnake (str) Convert a string to snake case.
isslug (str) Checks if a string is a valid slug.
issymbol (str) Check if a string is a valid symbol.


Functions

tocamel (str)
Convert a string to camel case.

Parameters:

  • str string The input string to convert

Returns:

    string The input converted to camel case.
tosnake (str)
Convert a string to snake case.

Parameters:

  • str string The input string to convert

Returns:

    string The input converted to snake case.
isslug (str)
Checks if a string is a valid slug.

For example: allowed a-z, A-Z, 0-9, -, and _ (no spaces). This is a relaxed version of issymbol where - is allowed.

Parameters:

  • str string The string to check

Returns:

    True if a valid slug.
issymbol (str)
Check if a string is a valid symbol.

The first character of a symbol must be one of _, a-z or A-Z, and subsequent characters may additionally be 0-9. This is, among other things, a valid C identifier, and generally compatible in most contexts which have restrictions on string identifiers, such as file paths.

Parameters:

  • str string The string to check

Returns:

    True is the string is a valid symbol.
generated by LDoc 1.5.0 Last updated 2024-02-18 20:31:17