strrepfile

버전 1.3.0.0 (2.19 KB) 작성자: Richard Crozier
Replace one or more strings in one or more files safely
다운로드 수: 362
업데이트 날짜: 2013/9/11

라이선스 보기

strrepfile(filename,S1,S2) replaces all occurrences of the string S1 in the file filename with the string S2. S1, S2 may also be cell arrays of strings of the same size, in which case the replacement is performed for each pair by performing a strrep using corresponding elements of the inputs. Alternatively S2 may be a string string with and S1 a cell array, in this case the single string S2 will replace all the strings in S1

-----

strrepfile replaces the string by creating a temporary copy of the file in which the replace is to be performed, replacing it in this file, and copying the file back to the original location for safety. Submission #42877 has the advantage of allowing regex replace, but is not as safe as this version. strrepfile could probably be modified to use regexprep quite easily.

---

Note strrepfile requires 'samesize.m' my file exchange contribution here: http://www.mathworks.com/matlabcentral/fileexchange/36636-samesize

인용 양식

Richard Crozier (2024). strrepfile (https://www.mathworks.com/matlabcentral/fileexchange/43086-strrepfile), MATLAB Central File Exchange. 검색됨 .

MATLAB 릴리스 호환 정보
개발 환경: R2012a
모든 릴리스와 호환
플랫폼 호환성
Windows macOS Linux
카테고리
Help CenterMATLAB Answers에서 Characters and Strings에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
버전 게시됨 릴리스 정보
1.3.0.0

asthetic change to description, no change to file

1.2.0.0

fixed bug in testing for string or cell array of strings filename

1.1.0.0

Improved and corrected help

1.0.0.0