Parse line as chat words
MIT License
Parse line as chat words.
This package is inspired to github.com/mattn/go-shellwords.
To develop a chat bot, it is useful to split a string into substrings. There are many awesome packages for cli tool, but it is out of scope for many of them to split a string into substrings. And some existing packages are made for shell, so they are inapropriate for the chat bot in terms of treat of special characters.
// ["<UXXXXX>", "echo", "hello world"], ""
args, text := chatwords.Split("<UXXXXX> echo 'hello world'", -1)
// ["<UXXXXX>", "echo"], " 'hello world'"
args, text := chatwords.Split("<UXXXXX> echo 'hello world'", 2)
The test code is also useful to understand this package's behavior.
'
, "
, \t
\\
This package is not for shell, so the number of special characters is very small.