Changeset 681

Show
Ignore:
Timestamp:
09/07/06 12:58:27 (2 years ago)
Author:
JeremyRuston
Message:

String "escape" functions in Strings.js should be grouped together for readability (ticket#147)

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • Branches/2.1/core/js/Strings.js

    r506 r681  
    5353                c = c.replace(new RegExp("\\" + s.substr(t,1),"g"),"\\" + s.substr(t,1)); 
    5454        return c; 
     55} 
     56 
     57// Convert "\" to "\s", newlines to "\n" (and remove carriage returns) 
     58String.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) 
     64String.prototype.unescapeLineBreaks = function() 
     65{ 
     66        return this.replace(/\\n/mg,"\n").replace(/\\s/mg,"\\").replace(/\r/mg,""); 
    5567} 
    5668 
     
    239251} 
    240252 
    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  
    253253String.prototype.startsWith = function(prefix)  
    254254{