temp.go 187 B

12345678910111213
  1. package main
  2. import (
  3. "strings"
  4. )
  5. func main() {
  6. s := "234.32.12.34:4222"
  7. idx := strings.LastIndex(s, ":")
  8. ip := s[:idx]
  9. port := strings.TrimLeft(s[idx:], ":")
  10. println(ip, port)
  11. }