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

推荐订阅源

T
The Exploit Database - CXSecurity.com
A
Arctic Wolf
K
Kaspersky official blog
T
Threat Research - Cisco Blogs
PCI Perspectives
PCI Perspectives
www.infosecurity-magazine.com
www.infosecurity-magazine.com
P
Privacy International News Feed
K
KPMG report finds enterprise disconnect between AI and its ROI | CIO
U
Unit 42
cs.CL updates on arXiv.org
cs.CL updates on arXiv.org
Simon Willison's Weblog
Simon Willison's Weblog
P
Privacy & Cybersecurity Law Blog
O
OpenAI News
量子位
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
C
Cisco Blogs
AWS News Blog
AWS News Blog
Vercel News
Vercel News
Microsoft Security Blog
Microsoft Security Blog
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
美团技术团队
T
Threatpost
S
Schneier on Security
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
C
Cyber Attacks, Cyber Crime and Cyber Security
Last Week in AI
Last Week in AI
C
CERT Recently Published Vulnerability Notes
Blog — PlanetScale
Blog — PlanetScale
C
Cybersecurity and Infrastructure Security Agency CISA
F
Full Disclosure
博客园_首页
N
Netflix TechBlog - Medium
Security Latest
Security Latest
有赞技术团队
有赞技术团队
Google DeepMind News
Google DeepMind News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
The Register - Security
The Register - Security
Application and Cybersecurity Blog
Application and Cybersecurity Blog
Recent Announcements
Recent Announcements
博客园 - Franky
P
Palo Alto Networks Blog
Project Zero
Project Zero
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
H
Help Net Security
Hacker News: Ask HN
Hacker News: Ask HN
Cisco Talos Blog
Cisco Talos Blog
H
Heimdal Security Blog
The Hacker News
The Hacker News
博客园 - 【当耐特】
GbyAI
GbyAI

博客园 - 景天

[转]mysql sql 百万级数据库优化方案 left outer join Ext.extend 【转】C#中文排序(拼音和笔画) Ext中Checkbox的注意事项 - 景天 - 博客园 表单从服务器端读取 [转]关于project2003中几个视图的认识 Oracle 常用数据字典、外键查询 Oracle 10 回收站 ASP.NET MVC beta 模板(Templates) 中文修正补丁 完整版 Oracle备份数据库的脚本 RadioButtonList的选择确认 Oracle10g常用命令 和 常用函数 Oracle 10g 笔记1 连接和SQL编写 .NET调用Oracle存储过程,使用数组类型的参数(如ArrayList) Oracle 存储过程 及 .net 调用 按钮事件 直接下载 任何文件格式 ASP.NET MVC beta 中文模板修正补丁 IE7\IE6 图片上传预览 - 景天 - 博客园
C++ 字符串替换
景天 · 2009-02-07 · via 博客园 - 景天

#include   <string>   
  #include   
<iostream>   
    
  
using   namespace   std;   
    
  
string&   replace_all(string&   str,const   string&   old_value,const   string&   new_value)   
  {   
  
while(true)   {   
  
string::size_type   pos(0);   
  
if(   (pos=str.find(old_value))!=string::npos   )   
  str.replace(pos,old_value.length(),new_value);   
  
else   break;   
  }   
  
return   str;   
  }   
    
  
string&   replace_all_distinct(string&   str,const   string&   old_value,const   string&   new_value)   
  {   
  
for(string::size_type   pos(0);   pos!=string::npos;   pos+=new_value.length())   {   
  
if(   (pos=str.find(old_value,pos))!=string::npos   )   
  str.replace(pos,old_value.length(),new_value);   
  
else   break;   
  }   
  
return   str;   
  }   
    
  
int   main()   
  {   
  cout   
<<   replace_all(string("12212"),"12","21")   <<   endl;   
  cout   
<<   replace_all_distinct(string("12212"),"12","21")   <<   endl;   
  }   
    
  
//output:   
  
//22211   
  
//21221