惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

WordPress大学
WordPress大学
The GitHub Blog
The GitHub Blog
F
Fortinet All Blogs
Cloudbric
Cloudbric
P
Palo Alto Networks Blog
T
Threatpost
T
Tor Project blog
T
Tenable Blog
AWS News Blog
AWS News Blog
Project Zero
Project Zero
L
LangChain Blog
Cyberwarzone
Cyberwarzone
Engineering at Meta
Engineering at Meta
雷峰网
雷峰网
C
CERT Recently Published Vulnerability Notes
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
Security Latest
Security Latest
云风的 BLOG
云风的 BLOG
I
Intezer
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
P
Proofpoint News Feed
A
Arctic Wolf
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google DeepMind News
Google DeepMind News
V
Vulnerabilities – Threatpost
C
Cybersecurity and Infrastructure Security Agency CISA
MongoDB | Blog
MongoDB | Blog
aimingoo的专栏
aimingoo的专栏
K
Kaspersky official blog
Jina AI
Jina AI
N
News | PayPal Newsroom
T
The Blog of Author Tim Ferriss
D
DataBreaches.Net
A
About on SuperTechFans
博客园 - 三生石上(FineUI控件)
博客园 - 【当耐特】
Hugging Face - Blog
Hugging Face - Blog
Recorded Future
Recorded Future
cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
S
Secure Thoughts
TaoSecurity Blog
TaoSecurity Blog
P
Privacy & Cybersecurity Law Blog
P
Proofpoint News Feed
MyScale Blog
MyScale Blog
IT之家
IT之家
Forbes - Security
Forbes - Security
The Hacker News
The Hacker News
Last Week in AI
Last Week in AI
T
Threat Research - Cisco Blogs
Y
Y Combinator Blog

博客园 - 网络隐士

[游戏] 连连看之eBay易趣搞笑版 [.NET之西天取经] (01) 即将踏上去硅谷的班机 张江大厦蒸包子,东湖物业真抠门 淘宝的人工封IP技术真好玩 感叹吴总落户易趣 美国签证二进宫 隐士搞定美国签证惊魂记 eBay之歌(Flash版) 阶乘运算之Python VS Java Python代码高亮显示工具 将GBK汉字转化为拼音的Python小程序 一个小巧的MySQL Shell 一个小巧的Python Shell 根据CDImage.cue产生自动改名命令的Python小程序 繁体中文转换为简体中文的PHP类 简体中文转换为繁体中文的PHP类 GBK汉字转化为拼音或笔画的PHP类 显示code39条形码的PHP类 JavaScript日历
文本间加入任意字符的PHP函数
网络隐士 · 2005-09-13 · via 博客园 - 网络隐士

<?
/***********************************************************************
                       Written by caocao
                       caocao@eastday.com
                       http://nethermit.yeah.net
                       
                       文本间加入任意字符的函数
                       输入:
                       $str:欲转换的代码
                       $insert:欲插入的字符
                       输出:
                       返回转换后的代码
***********************************************************************/
function m_text_insert($str, $insert
)
{
    
$output=""
;
    
$length=strlen($str
);
    for (
$i=0;$i<$length;$i
++)
    {
        if (
$i==$length-1)
//检查最后一个字符
        
{
            
$output.=$str[$i].$insert
;
            break;
        }
        
$code1=ord($str[$i
]);
        
$code2=ord($str[$i+1
]);
        if (
$code1>=0x81&&$code1<=0xFE&&$code2>=0x40&&$code2<=0xFE&&$code2!=0x7F)
//检查是否是GBK字符
            
$output.=substr($str, $i++, 2).$insert
;
        else if (
$code1==0xD&&$code2==0xA)
//检查是否是回车
            
$output.=substr($str, $i++, 2
);
        else
//普通字符
            
$output.=$str[$i].$insert
;
    }
    return
substr($output, 0, strlen($output)-strlen($insert
));
}
?>