dimscmd/utils

  Source   Edit

Procs

func checkSlashName(name: string): bool {....raises: [], tags: [].}
Checks if a slash command name is valid. A valid name must meet these criteria
  • Length is in between 1 and 32 (inclusive)
  • Only contains characters in the set {'a'..'z', '-', '_'}

Example:

assert not checkSlashName "calc +"
assert checkSlashName "calc plus"
assert not checkSlashName "Calc plus"
assert not checkSlashName "calc a"
  Source   Edit
func getWords(input: string): seq[string] {....raises: [], tags: [].}
Splits the input string into each word Handles multple spaces   Source   Edit
func leafName(input: string): string {....raises: [], tags: [].}
Returns the last word in a sentence   Source   Edit
func nextWord(input: string; output: var string; start = 0): int {....raises: [],
    tags: [].}
Gets the next word after start in the string and puts it in output   Source   Edit

Macros

macro matchIdent(id: string; body: untyped): untyped
Creates a case statement to match a string against other strings in style insensitive way   Source   Edit