PHP
·
发表于 5年以前
·
阅读量:8308
±¾ÎÄʵÀý×ܽaÁËphpÈ¥³ý×Öu´®ÖпÕ×ÖuµÄ³£Óý¨¡£ÖÏi¸ø´o¼Ò¹(C)´o¼Ò²Î¿¼¡£¾ßÌaÖÎoÈçÏ£º
phpÖаuº¬Ëĸo¿ÉÒÔÈ¥³ý×Ö*u´®¿Õ¸ñµÄº¯Êý£º
trim() ¨C È¥³ý×Öu´®Á½¶ËµÄ¿Õ×Öu
ltrim() ¨C È¥³ý×Öu´®Ç°¶ËµÄ¿Õ×Öu
rtrim() ¨C È¥³ý×Öu´®Ä(C)βµÄ¿Õ×Öu
chop() ¨Cͬrtrim().
´uÂeÈçÏ£º
<?php
$text = "\t \t jb51.net!\t \t ";
$leftTrimmed = ltrim($text);
$rightTrimmed = rtrim($text);
$bothTrimmed = trim($text);
print("leftTrimmed = ($leftTrimmed)\n");
print("rightTrimmed = ($rightTrimmed)\n");
print("bothTrimmed = ($bothTrimmed)\n");
?>
Êa³o½a¹u:
leftTrimmed = (jb51.net! )
rightTrimmed = ( jb51.net!)
bothTrimmed = (jb51.net!)
Ï£Íu±¾ÎÄËuÊo¶Ô´o¼ÒµÄphp³ÌÐoÉe¼ÆÓÐËu°iÖu¡£