Module gears.string

String module for gears

Functions

escape (text) Escape a string from XML char.
unescape (text) Unescape a string from entities.
linecount (text) Count number of lines in a string
linewrap (text, width, indent) Split a string into multiple lines
quote_pattern () Escape all special pattern-matching characters so that lua interprets them literally instead of as a character class.
query_to_pattern (s) Generate a pattern matching expression that ignores case.
split (str, delimiter) Split separates a string containing a delimiter into the list of substrings between that delimiter.


Functions

Methods
escape (text)
Escape a string from XML char. Useful to set raw text in textbox.
  • text Text to escape.

Returns:

    Escape text.
unescape (text)
Unescape a string from entities.
  • text Text to unescape.

Returns:

    Unescaped text.
linecount (text)
Count number of lines in a string

Returns:

    int Number of lines.
linewrap (text, width, indent)
Split a string into multiple lines
  • text String to wrap.
  • width Maximum length of each line. Default: 72.
  • indent Number of spaces added before each wrapped line. Default: 0.

Returns:

    The string with lines wrapped to width.
quote_pattern ()
Escape all special pattern-matching characters so that lua interprets them literally instead of as a character class. Source: http://stackoverflow.com/a/20778724/15690
query_to_pattern (s)
Generate a pattern matching expression that ignores case.
  • s Original pattern matching expression.
split (str, delimiter)
Split separates a string containing a delimiter into the list of substrings between that delimiter.
  • str string String to be splitted
  • delimiter string Character where the string will be splitted

Returns:

    table list of the substrings
generated by LDoc 1.4.6 Last updated 2017-07-25 16:21:08