4
0
mirror of https://github.com/cwinfo/matterbridge.git synced 2025-06-26 16:39:24 +00:00

Add MessageSplit option to split messages on MessageLength (irc). Closes #281

This commit is contained in:
Wim
2017-11-24 23:27:13 +01:00
parent 7ec95f786d
commit e0cbb69a4f
4 changed files with 25 additions and 2 deletions

View File

@ -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
}