1
0
mirror of https://github.com/duke-git/lancet.git synced 2026-02-04 12:52:28 +08:00

doc: update for release v2.3.5

This commit is contained in:
dudaodong
2025-03-06 20:02:33 +08:00
parent 90a3b87b67
commit 3696213e5d
6 changed files with 192 additions and 62 deletions

View File

@@ -49,6 +49,7 @@ import (
- [IsIp](#IsIp)
- [IsIpV4](#IsIpV4)
- [IsIpV6](#IsIpV6)
- [IsIpPort](#IsIpPort)
- [IsStrongPassword](#IsStrongPassword)
- [IsUrl](#IsUrl)
- [IsWeakPassword](#IsWeakPassword)
@@ -990,6 +991,43 @@ func main() {
}
```
### <span id="IsIpPort">IsIpPort</span>
<p>检查字符串是否是ip:port格式。</p>
<b>函数签名:</b>
```go
func IsIpPort(str string) bool
```
<b>示例:<span style="float:right;display:inline-block">[运行](todo)</span></b>
```go
import (
"fmt"
"github.com/duke-git/lancet/v2/validator"
)
func main() {
result1 := validator.IsIpPort("127.0.0.1:8080")
result2 := validator.IsIpPort("[0:0:0:0:0:0:0:1]:8080")
result3 := validator.IsIpPort(":8080")
result4 := validator.IsIpPort("::0:0:0:0:")
fmt.Println(result1)
fmt.Println(result2)
fmt.Println(result3)
fmt.Println(result4)
// Output:
// true
// true
// false
// false
}
```
### <span id="IsStrongPassword">IsStrongPassword</span>
<p>验证字符串是否是强密码:(alpha(lower+upper) + number + special chars(!@#$%^&*()?&gt&lt))。</p>

View File

@@ -49,6 +49,7 @@ import (
- [IsIp](#IsIp)
- [IsIpV4](#IsIpV4)
- [IsIpV6](#IsIpV6)
- [IsIpPort](#IsIpPort)
- [IsStrongPassword](#IsStrongPassword)
- [IsUrl](#IsUrl)
- [IsWeakPassword](#IsWeakPassword)
@@ -992,6 +993,43 @@ func main() {
}
```
### <span id="IsIpPort">IsIpPort</span>
<p>Check if the string is ip:port</p>
<b>Signature:</b>
```go
func IsIpPort(str string) bool
```
<b>Example:<span style="float:right;display:inline-block">[Run](todo)</span></b>
```go
import (
"fmt"
"github.com/duke-git/lancet/v2/validator"
)
func main() {
result1 := validator.IsIpPort("127.0.0.1:8080")
result2 := validator.IsIpPort("[0:0:0:0:0:0:0:1]:8080")
result3 := validator.IsIpPort(":8080")
result4 := validator.IsIpPort("::0:0:0:0:")
fmt.Println(result1)
fmt.Println(result2)
fmt.Println(result3)
fmt.Println(result4)
// Output:
// true
// true
// false
// false
}
```
### <span id="IsStrongPassword">IsStrongPassword</span>
<p>Check if the string is strong password (alpha(lower+upper) + number + special chars(!@#$%^&*()?gt&lt)).</p>