Your comment:
Trims all newlines on the back of the string (not real friendly code, though)
function StripLastNewLines(s){
while ((s.substring(s.length - 1, s.length) == "\n") || (s.substring(s.length - 1, s.length) == "\r"))
s = s.substring(0, s.length - 1);
return s;
}
This is that Regular Expressions are made for
function StripLastNewLines(s){
return s.replace(/[\n\r]*$/,'');
}
/ [\n\r] * $ /
[\n\r] class will match \n or \r
* will find 0 or more
$ at the end of the string
This blog will contain English as well as Dutch posts. I started only with English posts, but writing in a foreign language is sometimes a barrier to write at all.