summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2021-01-30 14:00:29 -0500
committerrsiddharth <s@ricketyspace.net>2021-01-30 14:00:29 -0500
commitd1e448cfa5a2c87de9a22f8717478a9c54bdda99 (patch)
tree385e5d7e50278a61a47948fbf520217f150b8086
parent7dfa85eb027fc27ff858e73f1a1ff5fd5e51a89a (diff)
lib: update StripSpaceChars
strip 'NUL' character too.
-rw-r--r--lib/str.go3
1 files changed, 3 insertions, 0 deletions
diff --git a/lib/str.go b/lib/str.go
index 6ba9507..bc25e2d 100644
--- a/lib/str.go
+++ b/lib/str.go
@@ -51,6 +51,9 @@ func StripSpaceChars(s string) string {
if s[i] == '\n' {
continue
}
+ if s[i] == 0 { // NUL character
+ continue
+ }
ss += string(s[i])
}
return ss