Cody

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

Solution 2100630

Submitted on 21 Jan 2020 by ariel afriat
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))

v = 'This is BETTER than C++' corrected = 'This is BETTER than C++' corrected = 'This is BETTER than C++' corrected = 'This is BETTER than C++' corrected = 'This is BETTER than C++' corrected = 'This is BETTER than C++' v = 'This Is BETTER than C++' corrected = 'This Is BETTER than C++' corrected = 'This Is BETTER than C++' corrected = 'This Is BETTER than C++' v = 'This Is bETTER than C++' v = 'This Is BETTER than C++' corrected = 'This Is BETTER than C++' v = 'This Is BeTTER than C++' corrected = 'This Is BeTTER than C++' v = 'This Is BetTER than C++' corrected = 'This Is BetTER than C++' v = 'This Is BettER than C++' corrected = 'This Is BettER than C++' v = 'This Is BetteR than C++' corrected = 'This Is BetteR than C++' v = 'This Is Better than C++' corrected = 'This Is Better than C++' corrected = 'This Is Better than C++' v = 'This Is Better Than C++' corrected = 'This Is Better Than C++' corrected = 'This Is Better Than C++' corrected = 'This Is Better Than C++' corrected = 'This Is Better Than C++' corrected = 'This Is Better Than C++' v = 'This Is Better Than c++' v = 'This Is Better Than C++' corrected = 'This Is Better Than C++' corrected = '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))

v = 'HEy, tHis iS vErY wroNg!' corrected = 'HEy, tHis iS vErY wroNg!' v = 'Hey, tHis iS vErY wroNg!' corrected = 'Hey, tHis iS vErY wroNg!' corrected = 'Hey, tHis iS vErY wroNg!' corrected = 'Hey, tHis iS vErY wroNg!' corrected = 'Hey, tHis iS vErY wroNg!' v = 'Hey, THis iS vErY wroNg!' corrected = 'Hey, THis iS vErY wroNg!' v = 'Hey, This iS vErY wroNg!' corrected = 'Hey, This iS vErY wroNg!' corrected = 'Hey, This iS vErY wroNg!' corrected = 'Hey, This iS vErY wroNg!' corrected = 'Hey, This iS vErY wroNg!' v = 'Hey, This IS vErY wroNg!' corrected = 'Hey, This IS vErY wroNg!' v = 'Hey, This Is vErY wroNg!' corrected = 'Hey, This Is vErY wroNg!' corrected = 'Hey, This Is vErY wroNg!' v = 'Hey, This Is VErY wroNg!' corrected = 'Hey, This Is VErY wroNg!' v = 'Hey, This Is VerY wroNg!' corrected = 'Hey, This Is VerY wroNg!' corrected = 'Hey, This Is VerY wroNg!' v = 'Hey, This Is Very wroNg!' corrected = 'Hey, This Is Very wroNg!' corrected = 'Hey, This Is Very wroNg!' v = 'Hey, This Is Very WroNg!' corrected = 'Hey, This Is Very WroNg!' corrected = 'Hey, This Is Very WroNg!' corrected = 'Hey, This Is Very WroNg!' v = 'Hey, This Is Very Wrong!' corrected = 'Hey, This Is Very Wrong!' corrected = '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))

v = 'THIS sENTENCE wILL bE iNVERTED' corrected = 'THIS sENTENCE wILL bE iNVERTED' v = 'ThIS sENTENCE wILL bE iNVERTED' corrected = 'ThIS sENTENCE wILL bE iNVERTED' v = 'ThiS sENTENCE wILL bE iNVERTED' corrected = 'ThiS sENTENCE wILL bE iNVERTED' v = 'This sENTENCE wILL bE iNVERTED' corrected = 'This sENTENCE wILL bE iNVERTED' corrected = 'This sENTENCE wILL bE iNVERTED' v = 'This SENTENCE wILL bE iNVERTED' corrected = 'This SENTENCE wILL bE iNVERTED' v = 'This SeNTENCE wILL bE iNVERTED' corrected = 'This SeNTENCE wILL bE iNVERTED' v = 'This SenTENCE wILL bE iNVERTED' corrected = 'This SenTENCE wILL bE iNVERTED' v = 'This SentENCE wILL bE iNVERTED' corrected = 'This SentENCE wILL bE iNVERTED' v = 'This SenteNCE wILL bE iNVERTED' corrected = 'This SenteNCE wILL bE iNVERTED' v = 'This SentenCE wILL bE iNVERTED' corrected = 'This SentenCE wILL bE iNVERTED' v = 'This SentencE wILL bE iNVERTED' corrected = 'This SentencE wILL bE iNVERTED' v = 'This Sentence wILL bE iNVERTED' corrected = 'This Sentence wILL bE iNVERTED' corrected = 'This Sentence wILL bE iNVERTED' v = 'This Sentence WILL bE iNVERTED' corrected = 'This Sentence WILL bE iNVERTED' v = 'This Sentence WiLL bE iNVERTED' corrected = 'This Sentence WiLL bE iNVERTED' v = 'This Sentence WilL bE iNVERTED' corrected = 'This Sentence WilL bE iNVERTED' v = 'This Sentence Will bE iNVERTED' corrected = 'This Sentence Will bE iNVERTED' corrected = 'This Sentence Will bE iNVERTED' v = 'This Sentence Will BE iNVERTED' corrected = 'This Sentence Will BE iNVERTED' v = 'This Sentence Will Be iNVERTED' corrected = 'This Sentence Will Be iNVERTED' corrected = 'This Sentence Will Be iNVERTED' v = 'This Sentence Will Be INVERTED' corrected = 'This Sentence Will Be INVERTED' v = 'This Sentence Will Be InVERTED' corrected = 'This Sentence Will Be InVERTED' v = 'This Sentence Will Be InvERTED' corrected = 'This Sentence Will Be InvERTED' v = 'This Sentence Will Be InveRTED' corrected = 'This Sentence Will Be InveRTED' v = 'This Sentence Will Be InverTED' corrected = 'This Sentence Will Be InverTED' v = 'This Sentence Will Be InvertED' corrected = 'This Sentence Will Be InvertED' v = 'This Sentence Will Be InverteD' corrected = 'This Sentence Will Be InverteD' v = '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))

v = 'this Sentence Will Not Be Changed' v = 'This Sentence Will Not Be Changed' corrected = 'This Sentence Will Not Be Changed' corrected = 'This Sentence Will Not Be Changed' corrected = 'This Sentence Will Not Be Changed' corrected = 'This Sentence Will Not Be Changed' corrected = 'This Sentence Will Not Be Changed' v = 'This sentence Will Not Be Changed' v = 'This Sentence Will Not Be Changed' corrected = 'This Sentence Will Not Be Changed' corrected = 'This Sentence Will Not Be Changed' corrected = 'This Sentence Will Not Be Changed' corrected = 'This Sentence Will Not Be Changed' corrected = 'This Sentence Will Not Be Changed' corrected = 'This Sentence Will Not Be Changed' corrected = 'This Sentence Will Not Be Changed' corrected = 'This Sentence Will Not Be Changed' corrected = 'This Sentence Will Not Be Changed' v = 'This Sentence will Not Be Changed' v = 'This Sentence Will Not Be Changed' corrected = 'This Sentence Will Not Be Changed' corrected = 'This Sentence Will Not Be Changed' corrected = 'This Sentence Will Not Be Changed' corrected = 'This Sentence Will Not Be Changed' corrected = 'This Sentence Will Not Be Changed' v = 'This Sentence Will not Be Changed' v = 'This Sentence Will Not Be Changed' corrected = 'This Sentence Will Not Be Changed' corrected = 'This Sentence Will Not Be Changed' corrected = 'This Sentence Will Not Be Changed' corrected = 'This Sentence Will Not Be Changed' v = 'This Sentence Will Not be Changed' v = 'This Sentence Will Not Be Changed' corrected = 'This Sentence Will Not Be Changed' corrected = 'This Sentence Will Not Be Changed' corrected = 'This Sentence Will Not Be Changed' v = 'This Sentence Will Not Be changed' v = 'This Sentence Will Not Be Changed' corrected = 'This Sentence Will Not Be Changed' corrected = 'This Sentence Will Not Be Changed' corrected = 'This Sentence Will Not Be Changed' corrected = 'This Sentence Will Not Be Changed' corrected = 'This Sentence Will Not Be Changed' corrected = '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))

v = 'hELLO THERE' v = 'HELLO THERE' corrected = 'HELLO THERE' v = 'HeLLO THERE' corrected = 'HeLLO THERE' v = 'HelLO THERE' corrected = 'HelLO THERE' v = 'HellO THERE' corrected = 'HellO THERE' v = 'Hello THERE' corrected = 'Hello THERE' corrected = 'Hello THERE' v = 'Hello tHERE' v = 'Hello THERE' corrected = 'Hello THERE' v = 'Hello ThERE' corrected = 'Hello ThERE' v = 'Hello TheRE' corrected = 'Hello TheRE' v = 'Hello TherE' corrected = 'Hello TherE' v = 'Hello There' corrected = 'Hello There'

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

v = 'alTeRnAtInG cApS' v = 'AlTeRnAtInG cApS' corrected = 'AlTeRnAtInG cApS' corrected = 'AlTeRnAtInG cApS' v = 'AlteRnAtInG cApS' corrected = 'AlteRnAtInG cApS' corrected = 'AlteRnAtInG cApS' v = 'AlternAtInG cApS' corrected = 'AlternAtInG cApS' corrected = 'AlternAtInG cApS' v = 'AlternatInG cApS' corrected = 'AlternatInG cApS' corrected = 'AlternatInG cApS' v = 'AlternatinG cApS' corrected = 'AlternatinG cApS' corrected = 'AlternatinG cApS' v = 'Alternating cApS' corrected = 'Alternating cApS' corrected = 'Alternating cApS' v = 'Alternating CApS' corrected = 'Alternating CApS' v = 'Alternating CapS' corrected = 'Alternating CapS' corrected = 'Alternating CapS' v = 'Alternating Caps' corrected = 'Alternating Caps'

Suggested Problems

More from this Author25

Community Treasure Hunt

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

Start Hunting!