How To Count Lines In A String Variable Using Perl
erics, July 20th, 2021
1 |
my $count = () = $string =~ /\n/g; |
1 |
my $count = () = $string =~ /\n/g; |
$text = str_replace(“\r”, “”, $text);
1 |
yourUpdatedVar = yourOriginalVar.replace(/\n/g, '<br />'); |
You must use all three lines together for it to work…YMMV:
1 2 3 |
$escaped = str_replace(chr(10),'\n',$original_value); $escaped = str_replace(chr(13),'\r',$escaped); $escaped = preg_replace("/(\r?\n)/","\n",$escaped); |