diff options
| author | Shulhan <ms@kilabit.info> | 2023-06-04 00:35:27 +0700 |
|---|---|---|
| committer | Shulhan <ms@kilabit.info> | 2023-06-04 01:01:01 +0700 |
| commit | f31dc2563c9d264a81ae3dd74f6c6a6a3db629c8 (patch) | |
| tree | 81bbb86f46ace5dbd371934dbed007dee9b877c9 /lib/bytes/bytes_example_test.go | |
| parent | a9198587b02ee060d8cacbe9d5ff19c5c1532a89 (diff) | |
| download | pakakeh.go-f31dc2563c9d264a81ae3dd74f6c6a6a3db629c8.tar.xz | |
lib/bytes: add function RemoveSpaces
Unlike TrimSpaces, which only remove spaces on beginning and end,
RemoveSpaces remove all spaces including in between characters.
Diffstat (limited to 'lib/bytes/bytes_example_test.go')
| -rw-r--r-- | lib/bytes/bytes_example_test.go | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/lib/bytes/bytes_example_test.go b/lib/bytes/bytes_example_test.go index 44889909..84796302 100644 --- a/lib/bytes/bytes_example_test.go +++ b/lib/bytes/bytes_example_test.go @@ -340,6 +340,18 @@ func ExampleReadUint32() { // 4043440900 } +func ExampleRemoveSpaces() { + var ( + in = []byte(" a\nb\tc d\r") + out = libbytes.RemoveSpaces(in) + ) + + fmt.Printf("%s\n", out) + + // Output: + // abcd +} + func ExampleSkipAfterToken() { text := []byte(`abc \def ghi`) |
