I\'m using the below code for wrapping long text, entered by users in a text area for commenting:
function addNewlines(comments) { var result = \'\'; while (
The ones above only work 99% of the time. This is the only one that works for me 100%: http://locutus.io/php/strings/wordwrap/