oxfordJoin

Create a single grammatically correct comma separated string from an array of strings

You are now following this Submission

Did you ever need to take a variable with a number of strings and create a grammatically correct comma separated string out of it? If so, here's the function for you! The input can be a array of strings or a cell array of chars; the output will be a string with commas, an and, and even an Oxford comma! Some examples:

output = oxfordJoin(["Yesterday","Today"])
output =
"Yesterday and Today"

output = oxfordJoin(["Yesterday","Today","Tomorrow"])
output =
"Yesterday, Today, and Tomorrow"

output = oxfordJoin({'Yesterday','Today','Tomorrow','Next Year'})
output =
"Yesterday, Today, Tomorrow, and Next Year"

Cite As

Brian Bagenstose (2026). oxfordJoin (https://www.mathworks.com/matlabcentral/fileexchange/83398-oxfordjoin), MATLAB Central File Exchange. Retrieved .

Tags

Add Tags

Add the first tag.

General Information

MATLAB Release Compatibility

  • Compatible with R2016b and later releases

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.0.0