| | 55 | } |
| | 56 | |
| | 57 | // Convert "\" to "\s", newlines to "\n" (and remove carriage returns) |
| | 58 | String.prototype.escapeLineBreaks = function() |
| | 59 | { |
| | 60 | return this.replace(/\\/mg,"\\s").replace(/\n/mg,"\\n").replace(/\r/mg,""); |
| | 61 | } |
| | 62 | |
| | 63 | // Convert "\n" to newlines, "\s" to "\" (and remove carriage returns) |
| | 64 | String.prototype.unescapeLineBreaks = function() |
| | 65 | { |
| | 66 | return this.replace(/\\n/mg,"\n").replace(/\\s/mg,"\\").replace(/\r/mg,""); |
| 241 | | // Convert "\" to "\s", newlines to "\n" (and remove carriage returns) |
| 242 | | String.prototype.escapeLineBreaks = function() |
| 243 | | { |
| 244 | | return this.replace(/\\/mg,"\\s").replace(/\n/mg,"\\n").replace(/\r/mg,""); |
| 245 | | } |
| 246 | | |
| 247 | | // Convert "\n" to newlines, "\s" to "\" (and remove carriage returns) |
| 248 | | String.prototype.unescapeLineBreaks = function() |
| 249 | | { |
| 250 | | return this.replace(/\\n/mg,"\n").replace(/\\s/mg,"\\").replace(/\r/mg,""); |
| 251 | | } |
| 252 | | |