From e0cbb69a4fa14f5f38417b19904a8b412deb2458 Mon Sep 17 00:00:00 2001 From: Wim Date: Fri, 24 Nov 2017 23:27:13 +0100 Subject: Add MessageSplit option to split messages on MessageLength (irc). Closes #281 --- bridge/helper/helper.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'bridge/helper') diff --git a/bridge/helper/helper.go b/bridge/helper/helper.go index ecfc4df2..0b6be4f4 100644 --- a/bridge/helper/helper.go +++ b/bridge/helper/helper.go @@ -26,3 +26,15 @@ func DownloadFile(url string) (*[]byte, error) { resp.Body.Close() return &data, nil } + +func SplitStringLength(input string, length int) string { + a := []rune(input) + str := "" + for i, r := range a { + str = str + string(r) + if i > 0 && (i+1)%length == 0 { + str += "\n" + } + } + return str +} -- cgit v1.2.3