ans =
'Mercury, Mars, Apollo'
Replace text in a string array of file names. Append the file names to the address of a
website. The file names contain spaces, but spaces cannot be part of web addresses.
Replace the space character, " ", with %20, which is the standard for web addresses.
str = ["Financial Report.docx";
"Quarterly 2015 Details.docx";
"Slides.pptx"]
str = 3x1 string array
"Financial Report.docx"
"Quarterly 2015 Details.docx"
"Slides.pptx"
newStr = replace(str," ","%20")
newStr = 3x1 string array
"Financial%20Report.docx"
"Quarterly%202015%20Details.docx"
"Slides.pptx"
Append the file names to the address of a website.
filenames = "http://example.com/Documents/" + newStr
filenames = 3x1 string array
"http://example.com/Documents/Financial%20Report.docx"
"http://example.com/Documents/Quarterly%202015%20Details.docx"
"http://example.com/Documents/Slides.pptx"
Extract Text
Extract a substring from string arrays or character vectors with the extractAfter,
extractBefore, and extractBetween functions. Use these functions to extract
different substrings that precede, follow, or occur between specified pieces of text.
Create a string array that contains file names. Extract the portions of the names after
C:\Temp\ with the extractAfter function.
6 Characters and Strings