Implemented ICal stringer

This commit is contained in:
Andreas Schneider 2018-04-01 11:22:55 +02:00
parent 9a346c5533
commit fed3e97308
1 changed files with 11 additions and 0 deletions

View File

@ -86,6 +86,17 @@ func (i *ICal) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error {
return nil return nil
} }
func (i ICal) String() string {
sb := &strings.Builder{}
for n, line := range i.data {
if n > 0 {
sb.WriteRune('\n')
}
sb.WriteString(line)
}
return sb.String()
}
func ParseICal(r io.Reader) (*ICal, error) { func ParseICal(r io.Reader) (*ICal, error) {
var data []string var data []string
scanner := bufio.NewScanner(r) scanner := bufio.NewScanner(r)