/[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.6 by sysadm, Sat Mar 12 08:01:19 2005 UTC Revision 1.8 by sysadm, Wed Apr 27 12:54:57 2005 UTC
# Line 1  Line 1 
1  <?  <?
2    
3  function split_line($str,$prefix="",$width=75)  function split_line($str,$prefix="",$width=76)
4  {  {
5          $lines = array();          $lines = array();
6          $lines_count = 0;          $lines_count = 0;
# Line 42  function split_line($str,$prefix="",$wid Line 42  function split_line($str,$prefix="",$wid
42          return $result;          return $result;
43  }  }
44    
45  function str_process($str,$prefix="",$width=75)  function str_process($str,$prefix="",$width=76)
46  {  {
47          $result = "";          $result = "";
48                    
49          $lines = explode("\n",str_replace("\r\n","\n",$str));          $lines = explode("\n",str_replace("\r\n","\n",$str));
50    
51          foreach($lines as $line)          foreach($lines as $tmp => $line)
52          {          {
53                  $result .= split_line($line[0],$prefix,$width);                  $result .= split_line($line,$prefix,$width);
54          }          }
55                    
56          return $result;          return $result;
# Line 61  function str_b_lines($str,$max_line=1) Line 61  function str_b_lines($str,$max_line=1)
61          $result = "";          $result = "";
62          $l = 0;          $l = 0;
63          $lines = explode("\n",str_replace("\r\n","\n",$str));          $lines = explode("\n",str_replace("\r\n","\n",$str));
64          foreach($lines as $line)          foreach($lines as $tmp => $line)
65          {          {
66                  $result .= ($line[0]."\r\n");                  $result .= ($line."\r\n");
67                  $l += (strlen($line[0])/256 + 1);                  $l += (strlen($line)/256 + 1);
68                  if ($l >= $max_line)                  if ($l >= $max_line)
69                          break;                          break;
70          }          }


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

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