-
Notifications
You must be signed in to change notification settings - Fork 8
/
str_join.go
59 lines (54 loc) · 1.14 KB
/
str_join.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
package filter
import "strings"
// 拼接string
func (self *Str) JoinStr(values ...string) *Str {
if self.err != nil {
return self
}
var value strings.Builder
value.WriteString(self.currentValue)
for k := range values {
value.WriteString(values[k])
}
self.currentValue = value.String()
return self
}
// JoinBytes 拼接bytes
func (self *Str) JoinBytes(values ...[]byte) *Str {
if self.err != nil {
return self
}
var value strings.Builder
value.WriteString(self.currentValue)
for k := range values {
value.Write(values[k])
}
self.currentValue = value.String()
return self
}
// JoinByte 拼接byte
func (self *Str) JoinByte(values ...byte) *Str {
if self.err != nil {
return self
}
var value strings.Builder
value.WriteString(self.currentValue)
for k := range values {
value.WriteByte(values[k])
}
self.currentValue = value.String()
return self
}
// JoinRune 拼接rune
func (self *Str) JoinRune(values ...rune) *Str {
if self.err != nil {
return self
}
var value strings.Builder
value.WriteString(self.currentValue)
for k := range values {
value.WriteRune(values[k])
}
self.currentValue = value.String()
return self
}