summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorrsiddharth <s@ricketyspace.net>2020-09-05 16:36:24 -0400
committerrsiddharth <s@ricketyspace.net>2020-09-05 16:36:24 -0400
commit08d36c4d61d1a02b3e2de34d6b56aef03b0cba94 (patch)
tree2958d844a6c3b24ea28957118b32511df4bc13e3 /lib
parent4af1ff746740ef70e03d6edae272d1fcdffba35a (diff)
lib: add stripSpaceChars
* lib/b64.go (stripSpaceChars): New function.
Diffstat (limited to 'lib')
-rw-r--r--lib/b64.go15
1 files changed, 15 insertions, 0 deletions
diff --git a/lib/b64.go b/lib/b64.go
index 6b98d42..bdf26c0 100644
--- a/lib/b64.go
+++ b/lib/b64.go
@@ -22,3 +22,18 @@ func HexToBase64(hex string) string {
func encode(b uint16) string {
return string(b64_table[b])
}
+
+// Strip space and newline characters from string.
+func stripSpaceChars(s string) string {
+ ss := ""
+ for i := 0; i < len(s); i++ {
+ if s[i] == ' ' {
+ continue
+ }
+ if s[i] == '\n' {
+ continue
+ }
+ ss += string(s[i])
+ }
+ return ss
+}