123456789101112131415161718192021222324252627282930 |
- package main
- import (
- "fmt"
- "strings"
- "time"
- )
- func main(){
- str := "Error 1062: Duplicate entry '3-3025176271438480383-1' for key 'datacaptureno'"
- if strings.Contains(str, "Duplicate entry"){
- strs :=strings.Split(str,` key '`)
- if len(strs) >1 {
- if len(strs[len(strs)-1])>1{
- str = strs[len(strs)-1][:len(strs[len(strs)-1])-1]
- }
- }
- }
- println(str)
- t,err :=time.Parse("2006-01-02","2006/02-03")
- if err!= nil{
- fmt.Println(err)
- }
- fmt.Println(t)
- }
|