Problem 649. Return the first and last characters of a character array
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
Problem Comments
-
4 Comments
Show
1 older comment
goc3
on 20 Jan 2021
The title and description have been updated, along with a few new test cases.
Bryce Lewis
on 5 May 2021
Wow this actually is such a great question
ML
on 28 Jan 2023
good problem
Solution Comments
Show commentsGroup

2022 New Year Cody Competition
- 30 Problems
- 4 Finishers
- Triangle Numbers
- Generate a vector like 1,2,2,3,3,3,4,4,4,4
- Make a random, non-repeating vector.
- Pizza!
- surrounded matrix
- Calculate the area of a triangle between three points
- Return the first and last characters of a character array
- Smallest distance between a point and a rectangle
- N-Queens Checker
- Minefield Sonar
- Get the length of a given vector
- Select every other element of a vector
- Acid and water
- Converts numbers into characters
- Rotate Matrix @180 degree
- linear least squares fitting
- Combined Ages 1 - Symmetric, n = 3
- Is this matrix orthogonal?
- Orthonormal matrix
- System of equations
- Remove NaN ?
- Find matching string from a list of strings
- calculate the day of the year from a date string.
- Matlab Basics - Convert a row vector to a column vector
- Which coins to give
- Fibonacci sequence
- Find max prime number
- Longest Divisor Run
- Perfect Square or not
- Word Counting and Indexing
Problem Recent Solvers10636
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!