diff options
| author | Shulhan <m.shulhan@gmail.com> | 2020-02-13 19:52:22 +0700 |
|---|---|---|
| committer | Shulhan <m.shulhan@gmail.com> | 2020-02-13 20:22:52 +0700 |
| commit | 95d99d745ad0da2f8a215ef96bb99ade46737f85 (patch) | |
| tree | 7eb4e5e1995dd041aabb4e5900f12ec372e3f396 /lib/strings | |
| parent | 5895c022230b51a94d11d3e366528adb419604cb (diff) | |
| download | pakakeh.go-95d99d745ad0da2f8a215ef96bb99ade46737f85.tar.xz | |
strings: simplify increment and decrement by one on Reverse function
Diffstat (limited to 'lib/strings')
| -rw-r--r-- | lib/strings/string.go | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/strings/string.go b/lib/strings/string.go index 1a8cb44e..ee271c35 100644 --- a/lib/strings/string.go +++ b/lib/strings/string.go @@ -128,8 +128,8 @@ func Reverse(input string) string { y := len(r) - 1 for x < len(r)/2 { r[x], r[y] = r[y], r[x] - x += 1 - y -= 1 + x++ + y-- } return string(r) } |
