<?xml version="1.0" encoding="UTF-8" ?>
<rss version="2.0">
<channel>
<title><![CDATA[阿Tim日志]]></title> 
<link>https://atim.cn/index.php</link> 
<description><![CDATA[专业的php开发者.开发团队的带队人]]></description> 
<language>zh-cn</language> 
<copyright><![CDATA[阿Tim日志]]></copyright>
<item>
<link>https://atim.cn/post//</link>
<title><![CDATA[[代码]中文字符截取类]]></title> 
<author>bkkkd &lt;partybase@gmail.com&gt;</author>
<category><![CDATA[开发应用]]></category>
<pubDate>Wed, 14 Sep 2005 16:18:47 +0000</pubDate> 
<guid>https://atim.cn/post//</guid> 
<description>
<![CDATA[ 
	class String<br /><br/><br /><br/>&#123;<br /><br/><br /><br/> &nbsp; &nbsp;/**<br /><br/><br /><br/> &nbsp; &nbsp; * subStrWithSuffix<br /><br/><br /><br/> &nbsp; &nbsp; * 中文字符截取 (Mon Aug 01 11:13:34 CST 2005)<br /><br/><br /><br/> &nbsp; &nbsp; * @version &nbsp; &nbsp; &nbsp; &nbsp;1.0.0<br /><br/><br /><br/> &nbsp; &nbsp; * @author &nbsp; &nbsp; &nbsp; &nbsp;<br /><br/><br /><br/> &nbsp; &nbsp; * @deprecated &nbsp; &nbsp;解决中文截取出现乱码<br /><br/><br /><br/> &nbsp; &nbsp; * @return &nbsp; &nbsp; &nbsp; &nbsp;string<br /><br/><br /><br/> &nbsp; &nbsp; */<br /><br/><br /><br/> &nbsp; &nbsp;function subStrWithChr ($string, $length, $start = 0)<br /><br/><br /><br/> &nbsp; &nbsp;&#123;<br /><br/><br /><br/> &nbsp; &nbsp; &nbsp; &nbsp;if ($start &lt; 0 || ($stringLength = strlen($string)) &lt; $start) return $string;<br /><br/><br /><br/> &nbsp; &nbsp; &nbsp; &nbsp;$length = (($length &lt; 1 || $length &gt; $stringLength)?$stringLength:$length);<br /><br/><br /> for ($i = 1, $o = ($start % 2)?2:1; ($start &gt; 0 &amp;&amp; $i<br/>&lt; $o &amp;&amp; ord(substr($string, $start , 1)) &gt; 0xa0); $i ++)<br/>$start --;<br /><br/><br /> for ($i = 1, $o = ($length % 2)?2:1; ($stringLength &gt; $length<br/>&amp;&amp; $i &lt; $o &amp;&amp; ord(substr($string, $length - 1 ,<br/>$length)) &gt; 0xa0); $i ++) $length ++;<br /><br/><br /><br/> &nbsp; &nbsp; &nbsp; &nbsp;$string = substr($string, $start, $length);<br /><br/><br /><br/> &nbsp; &nbsp; &nbsp; &nbsp;return $string;<br /><br/><br /><br/> &nbsp; &nbsp;&#125;<br /><br/><br /><br/><br /><br/><br /><br/> &nbsp; &nbsp;/**<br /><br/><br /><br/> &nbsp; &nbsp; * wordWrapWithChr<br /><br/><br /><br/> &nbsp; &nbsp; * 字符截行 (Mon Aug 01 14:15:37 CST 2005)<br /><br/><br /><br/> &nbsp; &nbsp; * @version &nbsp; &nbsp; &nbsp; &nbsp;1.0.0<br /><br/><br /><br/> &nbsp; &nbsp; * @author &nbsp; &nbsp; &nbsp; &nbsp;<br /><br/><br /><br/> &nbsp; &nbsp; * @deprecated &nbsp; &nbsp;解决中文截取出现乱码<br /><br/><br /><br/> &nbsp; &nbsp; * @return &nbsp; &nbsp; &nbsp; &nbsp;string<br /><br/><br /><br/> &nbsp; &nbsp; */<br /><br/><br /><br/> &nbsp; &nbsp;function wordWrapWithChr ($string, $width, $break = null)<br /><br/><br /><br/> &nbsp; &nbsp;&#123;<br /><br/><br /><br/> &nbsp; &nbsp; &nbsp; &nbsp;/**<br /><br/><br /><br/> &nbsp; &nbsp; &nbsp; &nbsp; * 中文标点符号怎么处理?暂时没有比较好的解决方案<br /><br/><br /><br/> &nbsp; &nbsp; &nbsp; &nbsp; * ，。？：；’‘“”、（）*……—…%￥€＄￡·！<br /><br/><br /><br/> &nbsp; &nbsp; &nbsp; &nbsp; */<br /><br/><br /> for ($break = $break?$break:&quot;\n&quot;, $line = 0, $text = array(),<br/>$handle = 0, $length = strlen($string); $handle &lt; $length; $handle<br/>+= strlen($text[$line ++]))<br /><br/><br /><br/> &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;$text[$line] = String::subStrWithChr($string, $width, $handle);<br /><br/><br /><br/> &nbsp; &nbsp; &nbsp; &nbsp;return implode($break, $text);/* &nbsp;*/<br /><br/><br /><br/> &nbsp; &nbsp;&#125;<br /><br/><br /><br/>&#125;<br /><br/><br /><br/>function startTimer()<br /><br/><br /><br/>&#123;<br /><br/><br /><br/> &nbsp; &nbsp;global $starttime;<br /><br/><br /><br/> &nbsp; &nbsp;$mtime = microtime ();<br /><br/><br /><br/> &nbsp; &nbsp;$mtime = explode (' ', $mtime);<br /><br/><br /><br/> &nbsp; &nbsp;$mtime = $mtime[1] + $mtime[0];<br /><br/><br /><br/> &nbsp; &nbsp;$starttime = $mtime;<br /><br/><br /><br/>&#125;<br /><br/><br /><br/>function endTimer()<br /><br/><br /><br/>&#123;<br /><br/><br /><br/> &nbsp; &nbsp;global $starttime;<br /><br/><br /><br/> &nbsp; &nbsp;$mtime = microtime ();<br /><br/><br /><br/> &nbsp; &nbsp;$mtime = explode (' ', $mtime);<br /><br/><br /><br/> &nbsp; &nbsp;$mtime = $mtime[1] + $mtime[0];<br /><br/><br /><br/> &nbsp; &nbsp;$endtime = $mtime;<br /><br/><br /><br/> &nbsp; &nbsp;$totaltime = round (($endtime - $starttime), 5);<br /><br/><br /><br/> &nbsp; &nbsp;return $totaltime;<br /><br/><br /><br/>&#125;<br /><br/><br /><br/>?&gt;<br/>
]]>
</description>
</item><item>
<link>https://atim.cn/post//#blogcomment</link>
<title><![CDATA[[评论] [代码]中文字符截取类]]></title> 
<author> &lt;user@domain.com&gt;</author>
<category><![CDATA[评论]]></category>
<pubDate>Thu, 01 Jan 1970 00:00:00 +0000</pubDate> 
<guid>https://atim.cn/post//#blogcomment</guid> 
<description>
<![CDATA[ 
	
]]>
</description>
</item>
</channel>
</rss>