Return the first and last characters of a character array, concatenated together. If there is only one character in the character array, the function should give that character back twice since it is both the first and last character of the character array.
Example:
stringfirstandlast('boring example') = 'be'

Solution Stats

21253 Solutions

11795 Solvers

Last Solution submitted on Feb 06, 2026

Last 200 Solutions

Problem Comments

Solution Comments

Show comments
Loading...

Group


Problem Recent Solvers11795

Community Treasure Hunt

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

Start Hunting!