Skip to content

Commit 6d6358d

Browse files
committed
docs adjusted
1 parent 04a4140 commit 6d6358d

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

README.md

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# StringFormatter
22

33
A set of a ***high performance string tools*** that helps to build strings from templates and process text faster than with `fmt`!!!.
4+
Slice printing is **50% faster with 8 items** slice and **250% with 20 items** slice
45

56
![GitHub go.mod Go version (subdirectory of monorepo)](https://img.shields.io/github/go-mod/go-version/wissance/stringFormatter?style=plastic)
67
![GitHub code size in bytes](https://img.shields.io/github/languages/code-size/wissance/stringFormatter?style=plastic)
@@ -76,6 +77,9 @@ For more convenient lines formatting we should choose how arguments are represen
7677
- `{0:F8}, 10.4567890 outputs -> 10.45678900`
7778
5. Percentage output
7879
- `{0:P100}, 12 outputs -> 12%`
80+
6. Lists
81+
- `{0:L-}, [1,2,3] outputs -> 1-2-3`
82+
- `{0:L, }, [1,2,3] outputs -> 1, 2, 3`
7983

8084
##### 1.2.4 Benchmarks of the Format and FormatComplex functions
8185

@@ -107,12 +111,26 @@ str := stringFormatter.MapToString(&options, "{key} : {value}", ", ")
107111
"connectTimeout : 1000, useSsl : true, login : sa, password : sa"
108112
```
109113

110-
#### 2.2 Benchmarks of the MapToStr function
114+
#### 2.2 Benchmarks of the MapToString function
111115

112116
* to see `MapToStr` result - `go test -bench=MapToStr -benchmem -cpu 1`
113117

114118
![MapToStr benchmarks](/img/map2str_benchmarks.png)
115119

120+
#### 2.3 Slice to string utility
121+
122+
`SliceToString` - function that converts slice with passed separation between items to string.
123+
```go
124+
slice := []any{100, "200", 300, "400", 500, 600, "700", 800, 1.09, "hello"}
125+
separator := ","
126+
result := stringFormatter.SliceToString(&slice, &separator)
127+
```
128+
129+
#### 2.4 Benchmarks of the SliceToString function
130+
131+
`sf` is rather fast then `fmt` 2.5 times (250%) faster on slice with 20 items, see benchmark:
132+
![SliceToStr benchmarks](/img/slice2str_benchmarks.png)
133+
116134
### 3. Contributors
117135

118136
<a href="https://github.com/Wissance/stringFormatter/graphs/contributors">

0 commit comments

Comments
 (0)