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

feat: add ToBigInt

This commit is contained in:
dudaodong
2024-12-02 11:25:16 +08:00
parent 8f3ea60636
commit 7fb49515ce
7 changed files with 217 additions and 61 deletions

View File

@@ -47,6 +47,7 @@ import (
- [ToUrlBase64](#ToUrlBase64)
- [ToRawStdBase64](#ToRawStdBase64)
- [ToRawUrlBase64](#ToRawUrlBase64)
- [ToBigInt](#ToBigInt)
<div STYLE="page-break-after: always;"></div>
@@ -1148,4 +1149,34 @@ func main() {
// dHJ1ZQ
// ZXJy
}
```
### <span id="ToBigInt">ToBigInt</span>
<p>值转换为bigInt。</p>
<b>函数签名:<span style="float:right;display:inline-block;">[运行](todo)</span></b>
```go
func ToBigInt[T constraints.Integer](v T) (*big.Int, error)
```
<b>示例:</b>
```go
package main
import (
"fmt"
"github.com/duke-git/lancet/v2/convertor"
)
func main() {
n := 9876543210
bigInt, _ := convertor.ToBigInt(n)
fmt.Println(bigInt)
// Output:
// 9876543210
}
```