MATLAB Programming Fundamentals - MathWorks

(やまだぃちぅ) #1

str = ["C:\Temp\MyReport.docx";
"C:\Temp\Data\Sample1.csv";
"C:\Temp\Slides.pptx"]


str = 3x1 string array
"C:\Temp\MyReport.docx"
"C:\Temp\Data\Sample1.csv"
"C:\Temp\Slides.pptx"


filenames = extractAfter(str,"C:\Temp\")


filenames = 3x1 string array
"MyReport.docx"
"Data\Sample1.csv"
"Slides.pptx"


Extract customer names from a string array that encodes the names within XML tags.


str = ["Elizabeth Day";
"George Adams";
"Sarah Young"]


str = 3x1 string array
"Elizabeth Day"
"George Adams"
"Sarah Young"


names = extractBetween(str,"","")


names = 3x1 string array
"Elizabeth Day"
"George Adams"
"Sarah Young"


See Also


contains | endsWith | erase | eraseBetween | extractAfter | extractBefore |
extractBetween | insertAfter | insertBefore | replace | replaceBetween |
startsWith | strfind | strrep


See Also
Free download pdf