插件4:删除空格
来源:互联网 发布:地理信息大数据 编辑:程序博客网 时间:2024/04/30 21:56
<?php // Plug-in 4: Strip Whitespace// This is an executable example with additional code supplied// To obtain just the plug-ins please click on the Download link$text = " We hold these truths to be self-evident, that all men are created equal, that they are endowed by their Creator with certain unalienable Rights, that among these are Life, Liberty and the pursuit of Happiness. ?That to secure these rights, \n\n \tGovernments are instituted among Men, deriving their just powers from the consent of the governed, ?That whenever any Form of Government becomes destructive \n \t of these ends, it is the Right of the People to alter or to abolish it, and to institute new Government, laying its foundation on such principles and organizing its powers in such form, as to them shall seem most likely to effect their Safety and Happiness. ";echo "<textarea cols='68' rows='11'>$text</textarea><br />";echo PIPHP_StripWhitespace($text);function PIPHP_StripWhitespace($text){ // Plug-in 4: Strip Whitespace // // This plug-in takes a string variable containing any // text and then strips out all whitespace characters. // The arguments rquired are: // // $text: Text to be modified return preg_replace('/\s+/', ' ', $text);}?>
1. 插件说明
这个插件接受一个包包含任何文本的字符串参数,将去掉全部多余空格。它需要一个参数:
$text——字符串变量,包含需要处理的文本。
- 插件4:删除空格
- 删除空格
- 删除 空格
- 删除空格
- 删除空格
- 删除空格
- 删除字符串中的空格
- 删除字符串中的空格
- 删除空格自定义函数
- 删除字符串中的空格
- 删除字符串中的空格
- 删除字符串空格
- 删除字符串中的空格
- String trim 删除空格
- 删除字符串多余空格
- 删除字符串多余空格
- 删除多余空格
- 删除字符串空格
- 简单工厂与策略模式的区别
- hdu 1718 Rank
- iPhone上的OpenAL音频(转自eggic.com)
- 算法导论之插入算法JAVA实现
- The Hadoop Distributed File System
- 插件4:删除空格
- ASCII 码的规律技巧
- MFC笔记——消息响应
- msgsnd与msgrcv函数出现invalid参数的问题
- php file_get_contents
- 做个有责任感的人
- IT人员必学最基础知识(一)——总括
- mod运算
- 程序员面试题精选--树为另一树的子结构