diff options
author | Wim <wim@42.be> | 2017-11-24 23:27:13 +0100 |
---|---|---|
committer | Wim <wim@42.be> | 2017-11-24 23:29:00 +0100 |
commit | e0cbb69a4fa14f5f38417b19904a8b412deb2458 (patch) | |
tree | 7d1029dbf4704f9454f2c71f52ea8262f8b05392 /bridge/helper | |
parent | 7ec95f786d55aab69541cb3065ea2c9b8eaf9c43 (diff) | |
download | matterbridge-msglm-e0cbb69a4fa14f5f38417b19904a8b412deb2458.tar.gz matterbridge-msglm-e0cbb69a4fa14f5f38417b19904a8b412deb2458.tar.bz2 matterbridge-msglm-e0cbb69a4fa14f5f38417b19904a8b412deb2458.zip |
Add MessageSplit option to split messages on MessageLength (irc). Closes #281
Diffstat (limited to 'bridge/helper')
-rw-r--r-- | bridge/helper/helper.go | 12 |
1 files changed, 12 insertions, 0 deletions
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 +} |