PHP » GoLang |
login |
register |
about
|
mb_strposmb_strposfunc mb_strpos(str, substr string) int { asciiPos := strings.Index(str, substr) if asciiPos == -1 || asciiPos == 0 { return asciiPos } pos := 0 totalSize := 0 reader := strings.NewReader(str) for { _, size, err := reader.ReadRune() if err != nil { return -1 } totalSize += size pos++ // got it if totalSize == asciiPos { return pos } } } |