I have tested your code with my additions and it runs without errors for string lengths up to and including 32767 characters. SO the 255 character limit is not correct.
I have tested your code with my additions and it runs without errors for string lengths up to and including 32767 characters. SO the 255 character limit is not correct.