Cody

# Problem 44499. Capitilize the first letter of every word in a string

Solution 2100638

Submitted on 21 Jan 2020 by anan jeraise
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
sentence = 'this is BETTER than C++'; corrected = 'This Is Better Than C++'; assert(isequal(autoCase(sentence), corrected))

sentence = 'This is better than c++' sp = 5 8 15 20 sentence = 'This Is better than c++' sentence = 'This Is Better than c++' sentence = 'This Is Better Than c++' sentence = 'This Is Better Than C++' corrected = 'This Is Better Than C++'

2   Pass
sentence = 'hEy, tHis iS vErY wroNg!'; corrected = 'Hey, This Is Very Wrong!'; assert(isequal(autoCase(sentence), corrected))

sentence = 'Hey, this is very wrong!' sp = 5 10 13 18 sentence = 'Hey, This is very wrong!' sentence = 'Hey, This Is very wrong!' sentence = 'Hey, This Is Very wrong!' sentence = 'Hey, This Is Very Wrong!' corrected = 'Hey, This Is Very Wrong!'

3   Pass
sentence = 'tHIS sENTENCE wILL bE iNVERTED'; corrected = 'This Sentence Will Be Inverted'; assert(isequal(autoCase(sentence), corrected))

sentence = 'This sentence will be inverted' sp = 5 14 19 22 sentence = 'This Sentence will be inverted' sentence = 'This Sentence Will be inverted' sentence = 'This Sentence Will Be inverted' sentence = 'This Sentence Will Be Inverted' corrected = 'This Sentence Will Be Inverted'

4   Pass
sentence = 'This Sentence Will Not Be Changed'; corrected = 'This Sentence Will Not Be Changed'; assert(isequal(autoCase(sentence), corrected))

sentence = 'This sentence will not be changed' sp = 5 14 19 23 26 sentence = 'This Sentence will not be changed' sentence = 'This Sentence Will not be changed' sentence = 'This Sentence Will Not be changed' sentence = 'This Sentence Will Not Be changed' sentence = 'This Sentence Will Not Be Changed' corrected = 'This Sentence Will Not Be Changed'

5   Pass
sentence = 'HELLO THERE'; corrected = 'Hello There'; assert(isequal(autoCase(sentence), corrected))

sentence = 'Hello there' sp = 6 sentence = 'Hello There' corrected = 'Hello There'

6   Pass
sentence = 'AlTeRnAtInG cApS'; corrected = 'Alternating Caps'; assert(isequal(autoCase(sentence), corrected))

sentence = 'Alternating caps' sp = 12 sentence = 'Alternating Caps' corrected = 'Alternating Caps'

### Community Treasure Hunt

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

Start Hunting!