Problem 44088. '5*3' copy character 3 - five times
The input is a string. Wherever a * sign occurs in string repeat copies of character on the right hand side of * sign. The number of copies is placed on left hand side of * sign.
input = '5*3'; output = '33333';
If the number of copies has two digits (never three or more digits) it will be presented in square brackets (the right hand side will always be a single character)
input = '[10]*3'; output = '3333333333'
See the test suite for more examples.
Solution Stats
Problem Comments
Solution Comments
Show commentsProblem Recent Solvers18
Suggested Problems
-
Is my wife right? Now with even more wrong husband
1316 Solvers
-
Find the largest value in the 3D matrix
1477 Solvers
-
Return the first and last characters of a character array
9137 Solvers
-
362 Solvers
-
146 Solvers
More from this Author92
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!