Cody

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

Solution 2110289

Submitted on 29 Jan 2020 by elias nekola
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))

l = 23 a = 1 sentence = 'This is BETTER than C++' a = 0 sentence = 'This is BETTER than C++' sentence = 'This is BETTER than C++' sentence = 'This is BETTER than C++' a = 1 sentence = 'This Is BETTER than C++' a = 0 sentence = 'This Is BETTER than C++' a = 1 sentence = 'This Is BETTER than C++' a = 0 sentence = 'This Is BeTTER than C++' sentence = 'This Is BetTER than C++' sentence = 'This Is BettER than C++' sentence = 'This Is BetteR than C++' sentence = 'This Is Better than C++' a = 1 sentence = 'This Is Better Than C++' a = 0 sentence = 'This Is Better Than C++' sentence = 'This Is Better Than C++' sentence = 'This Is Better Than C++' a = 1 sentence = 'This Is Better Than C++' a = 0 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))

l = 24 a = 1 sentence = 'HEy, tHis iS vErY wroNg!' a = 0 sentence = 'Hey, tHis iS vErY wroNg!' sentence = 'Hey, tHis iS vErY wroNg!' sentence = 'Hey, tHis iS vErY wroNg!' a = 1 sentence = 'Hey, THis iS vErY wroNg!' a = 0 sentence = 'Hey, This iS vErY wroNg!' sentence = 'Hey, This iS vErY wroNg!' sentence = 'Hey, This iS vErY wroNg!' a = 1 sentence = 'Hey, This IS vErY wroNg!' a = 0 sentence = 'Hey, This Is vErY wroNg!' a = 1 sentence = 'Hey, This Is VErY wroNg!' a = 0 sentence = 'Hey, This Is VerY wroNg!' sentence = 'Hey, This Is VerY wroNg!' sentence = 'Hey, This Is Very wroNg!' a = 1 sentence = 'Hey, This Is Very WroNg!' a = 0 sentence = 'Hey, This Is Very WroNg!' 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))

l = 30 a = 1 sentence = 'THIS sENTENCE wILL bE iNVERTED' a = 0 sentence = 'ThIS sENTENCE wILL bE iNVERTED' sentence = 'ThiS sENTENCE wILL bE iNVERTED' sentence = 'This sENTENCE wILL bE iNVERTED' a = 1 sentence = 'This SENTENCE wILL bE iNVERTED' a = 0 sentence = 'This SeNTENCE wILL bE iNVERTED' sentence = 'This SenTENCE wILL bE iNVERTED' sentence = 'This SentENCE wILL bE iNVERTED' sentence = 'This SenteNCE wILL bE iNVERTED' sentence = 'This SentenCE wILL bE iNVERTED' sentence = 'This SentencE wILL bE iNVERTED' sentence = 'This Sentence wILL bE iNVERTED' a = 1 sentence = 'This Sentence WILL bE iNVERTED' a = 0 sentence = 'This Sentence WiLL bE iNVERTED' sentence = 'This Sentence WilL bE iNVERTED' sentence = 'This Sentence Will bE iNVERTED' a = 1 sentence = 'This Sentence Will BE iNVERTED' a = 0 sentence = 'This Sentence Will Be iNVERTED' a = 1 sentence = 'This Sentence Will Be INVERTED' a = 0 sentence = 'This Sentence Will Be InVERTED' sentence = 'This Sentence Will Be InvERTED' sentence = 'This Sentence Will Be InveRTED' 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))

l = 33 a = 1 sentence = 'This Sentence Will Not Be Changed' a = 0 sentence = 'This Sentence Will Not Be Changed' sentence = 'This Sentence Will Not Be Changed' sentence = 'This Sentence Will Not Be Changed' a = 1 sentence = 'This Sentence Will Not Be Changed' a = 0 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' sentence = 'This Sentence Will Not Be Changed' sentence = 'This Sentence Will Not Be Changed' a = 1 sentence = 'This Sentence Will Not Be Changed' a = 0 sentence = 'This Sentence Will Not Be Changed' sentence = 'This Sentence Will Not Be Changed' sentence = 'This Sentence Will Not Be Changed' a = 1 sentence = 'This Sentence Will Not Be Changed' a = 0 sentence = 'This Sentence Will Not Be Changed' sentence = 'This Sentence Will Not Be Changed' a = 1 sentence = 'This Sentence Will Not Be Changed' a = 0 sentence = 'This Sentence Will Not Be Changed' a = 1 sentence = 'This Sentence Will Not Be Changed' a = 0 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' 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))

l = 11 a = 1 sentence = 'HELLO THERE' a = 0 sentence = 'HeLLO THERE' sentence = 'HelLO THERE' sentence = 'HellO THERE' sentence = 'Hello THERE' a = 1 sentence = 'Hello THERE' a = 0 sentence = 'Hello ThERE' sentence = 'Hello TheRE' sentence = 'Hello TherE' sentence = 'Hello There' corrected = 'Hello There'

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

l = 16 a = 1 sentence = 'AlTeRnAtInG cApS' a = 0 sentence = 'AlTeRnAtInG cApS' sentence = 'AlteRnAtInG cApS' sentence = 'AlteRnAtInG cApS' sentence = 'AlternAtInG cApS' sentence = 'AlternAtInG cApS' sentence = 'AlternatInG cApS' sentence = 'AlternatInG cApS' sentence = 'AlternatinG cApS' sentence = 'AlternatinG cApS' sentence = 'Alternating cApS' a = 1 sentence = 'Alternating CApS' a = 0 sentence = 'Alternating CapS' sentence = 'Alternating CapS' 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!