Module gears.string - awesome API documentation

# Module `gears.string`

String module for gears

## Functions

xml_escape (text) | Escape a string from XML char.
xml_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.
startswith (str, sub) | Check if a string starts with another string
endswith (str, sub) | Check if a string ends with another string

## Functions

Methods

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

  ### Returns:

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

  ### Returns:

  Unescaped text.
linecount (text)
  Count number of lines in a string
  - text string Input 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
startswith (str, sub)
  Check if a string starts with another string
  - str string String to search
  - sub string String to check for
endswith (str, sub)
  Check if a string ends with another string
  - str string String to search
  - sub string String to check for

generated by LDoc 1.4.6 Last updated 2019-02-08 01:08:53