32 lines
521 B
Go
32 lines
521 B
Go
package ircd
|
|
|
|
import (
|
|
"strings"
|
|
)
|
|
|
|
func AddrName(addr string) string {
|
|
parts := strings.SplitN(addr, "@", 2)
|
|
return parts[0]
|
|
}
|
|
|
|
func AddrHost(addr string) string {
|
|
parts := strings.SplitN(addr, "@", 2)
|
|
if len(parts) > 1 {
|
|
return parts[1]
|
|
}
|
|
return ""
|
|
}
|
|
|
|
func AddrSplit(addr string) (string, string) {
|
|
parts := strings.SplitN(addr, "@", 2)
|
|
if len(parts) > 1 {
|
|
return parts[0], parts[1]
|
|
}
|
|
return parts[0], ""
|
|
}
|
|
|
|
func AddrJoin(name string, host string) string {
|
|
return name + "@" + host
|
|
}
|
|
|
|
// vi:ts=4:sw=4:et
|