d45f6fc86c6c58ea48ebaa573eb273e4f70de320.svn-base 476 B

123456789101112131415161718192021222324252627282930
  1. package main
  2. import (
  3. "fmt"
  4. "strings"
  5. "time"
  6. )
  7. func main(){
  8. str := "Error 1062: Duplicate entry '3-3025176271438480383-1' for key 'datacaptureno'"
  9. if strings.Contains(str, "Duplicate entry"){
  10. strs :=strings.Split(str,` key '`)
  11. if len(strs) >1 {
  12. if len(strs[len(strs)-1])>1{
  13. str = strs[len(strs)-1][:len(strs[len(strs)-1])-1]
  14. }
  15. }
  16. }
  17. println(str)
  18. t,err :=time.Parse("2006-01-02","2006/02-03")
  19. if err!= nil{
  20. fmt.Println(err)
  21. }
  22. fmt.Println(t)
  23. }