태터데스크 관리자

도움말
닫기
적용하기   첫페이지 만들기

태터데스크 메시지

저장하였습니다.

std::string의 replace

2009/09/15 09:47

http://codepad.org/84iUC9tB


#include<cstdio>
#include<string> 
//by YuriHan.
using std::string;
string replace(const string& sOrg,const string& sFind,const string& sReplace) { string org = sOrg; for(string::size_type findpos = org.find(sFind);findpos != string::npos;findpos = org.find(sFind)) org.replace(findpos, sFind.size(), sReplace); return org; }
int main(void) { printf("%s\n",replace("abcdefgabcdefg","bcd","*****").c_str()); }
크리에이티브 커먼즈 라이선스
Creative Commons License

유리한 코드창고