I am requiring a specific functionality that can count the number of lines present inside a variable.
For example, "this\nis\nsome\nsample data" would return 4.
Is there any way to do this?
EDIT: I forgot to mention to the text being dealt with also contains HTML, so something like <p></p> would add an extra line too