A splitting function probably isn't going to care about your 1024 character limit. Two options off the top of my head are
- startIndex = 0
- endIndex = 1024
- endIndex = string.lastIndexOf('|', endIndex)
- partitionList.add(string.subString(startIndex, endIndex))
- startIndex = endIndex
- endIndex += 1024
- goto 3 :)
Or something like that, but check it for off-by-one errors. Alternatively, do something simpler like
- split the string on '|'
- concatenate pieces not exceeding 1024 in length, by counting the size of each piece