Skip to content

Commit

Permalink
Add itoa
Browse files Browse the repository at this point in the history
  • Loading branch information
motrboat authored Dec 23, 2023
1 parent 1029549 commit 0141cc2
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 0 deletions.
10 changes: 10 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,7 @@ func queryCount(db *sql.DB, filters []Filter) *sql.Row {
- [type hotcoalString](<#type-hotcoalstring>)
- [func Wrap\(s hotcoalString\) hotcoalString](<#func-wrap>)
- [func W\(s hotcoalString\) hotcoalString](<#func-w>)
- [func Itoa\(i int\) hotcoalString](<#func-itoa>)
- [func \(s hotcoalString\) String\(\) string](<#func-hotcoalstring-string>)
- [type Slice](<#type-slice>)
- [type allowlistT](<#type-allowlistt>)
Expand Down Expand Up @@ -249,6 +250,15 @@ func W(s hotcoalString) hotcoalString
The W function is a shorthand for Wrap


#### func [Itoa](<https://github.com/motrboat/hotcoal/blob/main/strconv.go#L6>)

```go
func Itoa(i int) hotcoalString
```

The Itoa function converts an int to a hotcoalString.


#### func \(hotcoalString\) [String](<https://github.com/motrboat/hotcoal/blob/main/hotcoal.go#L17>)

```go
Expand Down
8 changes: 8 additions & 0 deletions strconv.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package hotcoal

import "strconv"

// The Itoa function converts an int to a hotcoalString.
func Itoa(i int) hotcoalString {
return hotcoalString(strconv.Itoa(i))
}
9 changes: 9 additions & 0 deletions strconv_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package hotcoal

import "testing"

func TestItoa(t *testing.T) {
if "123" != Itoa(123).String() {
t.Fail()
}
}

0 comments on commit 0141cc2

Please sign in to comment.