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:
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user