-
Notifications
You must be signed in to change notification settings - Fork 48
/
Copy pathmain.go
66 lines (61 loc) · 1.51 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
// Copyright 2015 go-fuzz project authors. All rights reserved.
// Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.
package strings
import (
"strings"
"unicode"
)
func Fuzz(data []byte) int {
s := string(data)
si := len(s) / 4 * 3
s0 := s[:si]
s1 := s[si:]
s2, r := splitRune(s)
s3 := s[:len(s)/2]
s4 := s[len(s)/2:]
s5 := s[:len(s)/3]
s6 := s[len(s)/3 : len(s)/3*2]
s7 := s[len(s)/3*2:]
strings.Contains(s0, s1)
strings.ContainsAny(s0, s1)
strings.ContainsRune(s, r)
strings.Count(s0, s1)
strings.EqualFold(s3, s4)
fields := strings.Fields(s)
strings.HasPrefix(s0, s1)
strings.HasSuffix(s0, s1)
strings.Index(s0, s1)
strings.IndexAny(s0, s1)
strings.IndexByte(s2, byte(r))
strings.IndexRune(s2, r)
strings.Join(fields, " ")
strings.LastIndex(s0, s1)
strings.LastIndexAny(s0, s1)
strings.Repeat(s, 2)
strings.Replace(s, s0, s1, -1)
strings.Split(s0, s1)
strings.SplitAfter(s0, s1)
strings.SplitAfterN(s0, s1, 2)
strings.SplitN(s0, s1, 2)
strings.Title(s)
strings.ToLower(s)
strings.ToLowerSpecial(unicode.AzeriCase, s)
strings.ToTitle(s)
strings.ToTitleSpecial(unicode.AzeriCase, s)
strings.ToUpper(s)
strings.ToUpperSpecial(unicode.AzeriCase, s)
strings.Trim(s0, s1)
strings.TrimLeft(s0, s1)
strings.TrimPrefix(s0, s1)
strings.TrimRight(s0, s1)
strings.TrimSpace(s)
strings.TrimSuffix(s0, s1)
strings.NewReplacer(s5, s6).Replace(s7)
return 0
}
func splitRune(s string) (string, rune) {
for i, r := range s {
return s[i:], r
}
return s, 0
}