--- fenglin/lib/str_process.inc.php 2025/03/26 07:09:08 1.12 +++ fenglin/lib/str_process.inc.php 2025/03/28 10:31:26 1.13 @@ -32,7 +32,7 @@ function str_length($str) return $ret; } -function split_line($str, $prefix = "", $width = 76, $lines_limit = PHP_INT_MAX) +function split_line($str, $prefix = "", $width = 76, $lines_limit = PHP_INT_MAX, $end_of_line = "\n") { if ($width <= 0) return $str; @@ -57,7 +57,12 @@ function split_line($str, $prefix = "", if ($c == "\n") { - $result .= ($line . "\n"); + if ($lines_count + 1 >= $lines_limit) + { + break; + } + + $result .= ($line . $end_of_line); $lines_count++; $line = $prefix; $line_len = $prefix_len; @@ -85,7 +90,7 @@ function split_line($str, $prefix = "", break; } - $result .= ($line . "\n"); + $result .= ($line . $end_of_line); $lines_count++; $line = $prefix; $line_len = $prefix_len; @@ -106,7 +111,7 @@ function split_line($str, $prefix = "", break; } - $result .= ($line . "\n"); + $result .= ($line . $end_of_line); $lines_count++; $line = $prefix; $line_len = $prefix_len;