Skip to content

Commit 6b2fd72

Browse files
committed
update README
1 parent dbfa185 commit 6b2fd72

File tree

2 files changed

+48
-0
lines changed

2 files changed

+48
-0
lines changed

README.md

+24
Original file line numberDiff line numberDiff line change
@@ -99,30 +99,45 @@ cvt.BoolE([]int{1, 2}) // true,nil
9999
cvt.BoolE([]byte("true")) // true,nil
100100
```
101101

102+
- BoolP
103+
```go
104+
cvt.BoolP("true") // (*bool)(0x14000126180)(true)
105+
```
106+
102107
> more case see [bool_test.go](bool_test.go)
103108
104109

105110
### int
106111
- Int
107112
- IntE
113+
- IntP
108114
- Int8
109115
- Int8E
116+
- Int8P
110117
- Int16
111118
- Int16E
119+
- Int16P
112120
- Int32
113121
- Int32E
122+
- Int32P
114123
- Int64
115124
- Int64E
125+
- Int64P
116126
- Uint
117127
- UintE
128+
- UintP
118129
- Uint8
119130
- Uint8E
131+
- Uint8P
120132
- Uint16
121133
- Uint16E
134+
- Uint16P
122135
- Uint32
123136
- Uint32E
137+
- Uint32P
124138
- Uint64
125139
- Uint64E
140+
- Uint64P
126141

127142
```go
128143
cvt.Int(int8(8)) // 8
@@ -139,6 +154,8 @@ cvt.Int(OrderType(3)) // 3
139154

140155
var po OrderType = 3
141156
cvt.Int(&po) // 3
157+
158+
cvt.IntP("12") // (*int)(0x140000a4180)(12)
142159
```
143160

144161
> more case see [int_test.go](int_test.go)
@@ -147,6 +164,7 @@ cvt.Int(&po) // 3
147164
### string
148165
- String
149166
- StringE
167+
- StringP
150168

151169
```go
152170
cvt.String(uint(8)) // "8"
@@ -170,6 +188,8 @@ func (TestMarshalJSON) MarshalJSON() ([]byte, error) {
170188
}
171189
cvt.String(TestMarshalJSON{}) // "custom marshal"
172190
cvt.String(&TestMarshalJSON{}) // "custom marshal"
191+
192+
cvt.StringP(8.31) // (*string)(0x14000110320)((len=3) "123")
173193
```
174194

175195
> more case see [string_test.go](string_test.go)
@@ -178,8 +198,10 @@ cvt.String(&TestMarshalJSON{}) // "custom marshal"
178198
### float
179199
- Float32
180200
- Float32E
201+
- Float32P
181202
- Float64
182203
- Float64E
204+
- Float64P
183205

184206
```go
185207
cvt.Float64(int32(8)) // 8
@@ -195,6 +217,8 @@ type PointerTypeInt *AliasTypeInt
195217
cvt.Float64(AliasTypeInt(8)) // 8
196218
cvt.Float64((*AliasTypeInt)(nil)) // 0
197219
cvt.FLoat64((*PointerTypeInt)(nil)) // 0
220+
221+
cvt.Float64P("12.3") // (*float64)(0x14000126180)(12.3)
198222
```
199223

200224
> more case see [float_test.go](float_test.go)

README_ZH.md

+24
Original file line numberDiff line numberDiff line change
@@ -99,30 +99,45 @@ cvt.BoolE([]int{1, 2}) // true,nil
9999
cvt.BoolE([]byte("true")) // true,nil
100100
```
101101

102+
- BoolP
103+
```go
104+
cvt.BoolP("true") // (*bool)(0x14000126180)(true)
105+
```
106+
102107
> 更多示例: [bool_test.go](bool_test.go)
103108
104109

105110
### int
106111
- Int
107112
- IntE
113+
- IntP
108114
- Int8
109115
- Int8E
116+
- Int8P
110117
- Int16
111118
- Int16E
119+
- Int16P
112120
- Int32
113121
- Int32E
122+
- Int32P
114123
- Int64
115124
- Int64E
125+
- Int64P
116126
- Uint
117127
- UintE
128+
- UintP
118129
- Uint8
119130
- Uint8E
131+
- Uint8P
120132
- Uint16
121133
- Uint16E
134+
- Uint16P
122135
- Uint32
123136
- Uint32E
137+
- Uint32P
124138
- Uint64
125139
- Uint64E
140+
- Uint64P
126141

127142
```go
128143
cvt.Int(int8(8)) // 8
@@ -139,6 +154,8 @@ cvt.Int(OrderType(3)) // 3
139154

140155
var po OrderType = 3
141156
cvt.Int(&po) // 3
157+
158+
cvt.IntP("12") // (*int)(0x140000a4180)(12)
142159
```
143160

144161
> 更多示例: [int_test.go](int_test.go)
@@ -147,6 +164,7 @@ cvt.Int(&po) // 3
147164
### string
148165
- String
149166
- StringE
167+
- StringP
150168

151169
```go
152170
cvt.String(uint(8)) // "8"
@@ -170,6 +188,8 @@ func (TestMarshalJSON) MarshalJSON() ([]byte, error) {
170188
}
171189
cvt.String(TestMarshalJSON{}) // "custom marshal"
172190
cvt.String(&TestMarshalJSON{}) // "custom marshal"
191+
192+
cvt.StringP(8.31) // (*string)(0x14000110320)((len=3) "123")
173193
```
174194

175195
> 更多示例: [string_test.go](string_test.go)
@@ -178,8 +198,10 @@ cvt.String(&TestMarshalJSON{}) // "custom marshal"
178198
### float
179199
- Float32
180200
- Float32E
201+
- Float32P
181202
- Float64
182203
- Float64E
204+
- Float64P
183205

184206
```go
185207
cvt.Float64(int32(8)) // 8
@@ -195,6 +217,8 @@ type PointerTypeInt *AliasTypeInt
195217
cvt.Float64(AliasTypeInt(8)) // 8
196218
cvt.Float64((*AliasTypeInt)(nil)) // 0
197219
cvt.FLoat64((*PointerTypeInt)(nil)) // 0
220+
221+
cvt.Float64P("12.3") // (*float64)(0x14000126180)(12.3)
198222
```
199223

200224
> 更多示例: [float_test.go](float_test.go)

0 commit comments

Comments
 (0)