Mirror of github.com/gissleh/irc
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

17 lines
389 B

  1. package ircutil
  2. import (
  3. "strings"
  4. )
  5. // ParseArgAndText parses a text like "#Channel stuff and things" into "#Channel"
  6. // and "stuff and things". This is commonly used for input commands which has
  7. // no standard
  8. func ParseArgAndText(s string) (arg, text string) {
  9. spaceIndex := strings.Index(s, " ")
  10. if spaceIndex == -1 {
  11. return s, ""
  12. }
  13. return s[:spaceIndex], s[spaceIndex+1:]
  14. }