文字列の最初と最後の文字をつなげて返すような関数を作成しましょう。 もし文字が一つしかない場合、その文字は最初と最後の文字のため、関数はその文字を二回返すようにしておきましょう。
例:
stringfirstandlast('boring example') = 'be'- (英語版) Problem 649. Return the first and last character of a string https://www.mathworks.com/matlabcentral/cody/problems/649
Solution Stats
Problem Comments
Solution Comments
Show comments
Loading...
Problem Recent Solvers345
Suggested Problems
-
Find the longest sequence of 1's in a binary sequence.
6683 Solvers
-
Number of 1s in a binary string
10973 Solvers
-
530 Solvers
-
Calculate the Number of Sign Changes in a Row Vector (No Element Is Zero)
900 Solvers
-
390 Solvers
More from this Author12
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!