diff options
author | rsiddharth <s@ricketyspace.net> | 2020-09-05 16:36:24 -0400 |
---|---|---|
committer | rsiddharth <s@ricketyspace.net> | 2020-09-05 16:36:24 -0400 |
commit | 08d36c4d61d1a02b3e2de34d6b56aef03b0cba94 (patch) | |
tree | 2958d844a6c3b24ea28957118b32511df4bc13e3 /lib | |
parent | 4af1ff746740ef70e03d6edae272d1fcdffba35a (diff) |
lib: add stripSpaceChars
* lib/b64.go (stripSpaceChars): New function.
Diffstat (limited to 'lib')
-rw-r--r-- | lib/b64.go | 15 |
1 files changed, 15 insertions, 0 deletions
@@ -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 +} |