/[LeafOK_CVS]/fenglin/lib/str_process.inc.php
ViewVC logotype

Diff of /fenglin/lib/str_process.inc.php

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.12 by sysadm, Wed Mar 26 07:09:08 2025 UTC Revision 1.13 by sysadm, Fri Mar 28 10:31:26 2025 UTC
# Line 32  function str_length($str) Line 32  function str_length($str)
32          return $ret;          return $ret;
33  }  }
34    
35  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")
36  {  {
37          if ($width <= 0)          if ($width <= 0)
38                  return $str;                  return $str;
# Line 57  function split_line($str, $prefix = "", Line 57  function split_line($str, $prefix = "",
57                                                                    
58                  if ($c == "\n")                  if ($c == "\n")
59                  {                  {
60                          $result .= ($line . "\n");                          if ($lines_count + 1 >= $lines_limit)
61                            {
62                                    break;
63                            }
64    
65                            $result .= ($line . $end_of_line);
66                          $lines_count++;                          $lines_count++;
67                          $line = $prefix;                          $line = $prefix;
68                          $line_len = $prefix_len;                          $line_len = $prefix_len;
# Line 85  function split_line($str, $prefix = "", Line 90  function split_line($str, $prefix = "",
90                                          break;                                          break;
91                                  }                                  }
92    
93                                  $result .= ($line . "\n");                                  $result .= ($line . $end_of_line);
94                                  $lines_count++;                                  $lines_count++;
95                                  $line = $prefix;                                  $line = $prefix;
96                                  $line_len = $prefix_len;                                  $line_len = $prefix_len;
# Line 106  function split_line($str, $prefix = "", Line 111  function split_line($str, $prefix = "",
111                                  break;                                  break;
112                          }                          }
113    
114                          $result .= ($line . "\n");                          $result .= ($line . $end_of_line);
115                          $lines_count++;                          $lines_count++;
116                          $line = $prefix;                          $line = $prefix;
117                          $line_len = $prefix_len;                          $line_len = $prefix_len;


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1