StrrepLikeRegexprep

Version 1.0.0.0 (857 octets) par Michael Robbins
STRREP, but uses the input and output format of REGEXPREP
2K téléchargements
Mise à jour 3 juin 2005

Aucune licence

STRREPLIKEREGEXPREP Replace string with another.
This function uses STRREP, but uses the input and output format of REGEXPREP so it can be easily substituted.

S = STRREPLIKEREGEXPREP(STRING,SEARCH,REPLACE) replaces all occurrences of the the search string, SEARCH, in string, STRING, with the string,% REPLACE. The new string is returned. If no matches are found STRREPLIKEREGEXPREP returns STRING unchanged.

If STRING is a cell array of strings, STRREPLIKEREGEXPREP returns a cell array of strings replacing each element of STRING individually.

If SEARCH is a cell array of strings, STRREPLIKEREGEXPREP replaces each element of SEARCH sequentially.

If REPLACE is a cell array of strings, then SEARCH must be a cell array of strings with the same number of elements. STRREPLIKEREGEXPREP will replace each element of SEARCH sequentially with the corresponding element of REPLACE.

Example:
InputStr = {'we the people,','in oder to form','a more perfct'}
SearchStr = {'we','oder','perfct'};
ReplaceStr = {'We','order','perfect'};
StrrepLikeRegexprep(InputStr, SearchStr, ReplaceStr)
returns {'We the people,','in order to form','a more perfect'}

Citation pour cette source

Michael Robbins (2024). StrrepLikeRegexprep (https://www.mathworks.com/matlabcentral/fileexchange/7766-strreplikeregexprep), MATLAB Central File Exchange. Extrait(e) le .

Compatibilité avec les versions de MATLAB
Créé avec R13
Compatible avec toutes les versions
Plateformes compatibles
Windows macOS Linux
Catégories
En savoir plus sur Characters and Strings dans Help Center et MATLAB Answers

Community Treasure Hunt

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

Start Hunting!
Version Publié le Notes de version
1.0.0.0