04-12-2011

Javascript Count linebreaks

This function is quite quick and efficient in counting and returning the number of linebreaks in a string:

var countLinebreaks = function(str){
	return str.split(/\n|\f/).length;
}
 

Comments:

Your comment:

»
sabry 22/04/2013, 10:44 pm
plz make demo for your scripts

 

[x]