If you are programming in PHP, it is useful to split lines by \n
and then trim()
each line (provided you don't care about whitespace) to give you a "clean" line regardless.
foreach($line in explode("\n", $data))
{
$line = trim($line);
...
}