add trim leading function

This commit is contained in:
zhj4478 2018-06-05 15:26:55 -07:00
parent efc003288c
commit 701f1bc60a
3 changed files with 23 additions and 1 deletions

View file

@ -1,5 +1,9 @@
package pm
import (
"regexp"
)
var armorHeader = map[string]string{
"Version": "OpenPGP Golang 0.0.1 (" + Version() + ")",
"Comment": "https://protonmail.com",
@ -21,3 +25,8 @@ type Address struct {
// address_name : string;
keys []Key
}
func trimNewlines(input string) string {
var re = regexp.MustCompile(`(?m)[ \t]*$`)
return re.ReplaceAllString(input, "")
}