Problem 35. Quote Doubler
Solution Stats
Problem Comments
-
6 Comments
This problem description would benefit from an example of the kind of input that could be expected (as well as the correct output).
Based on the description, I thought that I had to replace the string 'o'clock' with the string 'o''clock' (so making it usable in MATLAB.). And no, I did not manage to create input like that.
Instead, you want to replace every single quote with a double quote EXCEPT for the start-and-end quotes.
So 'o''clock' ==> 'o''''clock'
an example would make it clearer
I am not getting it .... Its always showing wrong
so weird!!!
I've found no matter how many '''' I add, it will only show one additional.
My answers are coming correct in MATLAB 2017b but not on this site.
Solution Comments
-
1 Comment
Learn regexprep. It makes such string-related questions easier.
-
1 Comment
weird+1
it shows correct in my local matlab_2019b
-
1 Comment
Matlab's version of backslash plague!
-
1 Comment
The intention was to make a correct preallocation and the fill it without needing to extend the string or reshuffle its content. It would be good to gain more insight into how the size is calculated. Criteria for evaluating code is not only code size but memory and time efficiency, and efficiency in writing and maintaining the code.
-
1 Comment
I look forward to discerning what that output really is supposed to be. Running into difficulty.
Problem Recent Solvers2460
Suggested Problems
-
1488 Solvers
-
561 Solvers
-
786 Solvers
-
Flip the vector from right to left
6589 Solvers
-
807 Solvers
More from this Author96
Problem Tags
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!