titleCase - % - Every char in str that is not the first...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
% 9/10/2009 12:32 AM % Function Name: titleCase % Input: 1. char vector - a string. % Output: 1. char vector - a string in title case. % % Function Description: % The function takes one string and returns the string in title case. % That is, every first letter in every word should be capitalized, and % every other letter should be lowercase. % % To spell it out for you: % - Every char in str that is the first letter of a word and a lower % case letter should become upper case.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: % - Every char in str that is not the first letter of a word and a % upper case letter should become lower case. % function str = titleCase(str) str = lower(str); % making everything lowercase change = [1 (strfind(str, ' ')+1)]; % determining the indices of the letters to change to upper case str(change) = upper(str(change)); % changing the letters to upper case using the indices % then assigning it to str to be returned...
View Full Document

This note was uploaded on 10/22/2009 for the course CS 1371 taught by Professor Stallworth during the Fall '08 term at Georgia Institute of Technology.

Ask a homework question - tutors are online