UPPER – Changes stuff to UPPERCASE › “cookie” becomes “COOKIE” lower – Anybody wanna guess? › “DuH LoLoLoL” becomes “duh lololol” Valuable for checking equivalence › Check UPPER (or lower) of string if you want to compare not case sensitive Exercise: Change UNC to Tar Heel
Last parameter identifies the instance to replace Very valuable feature How can you find the LAST word? Exercise: Last word
Trim › Remember “a ” and “a” aren’t the same › Trim gets rid of leading blanks trailing blanks extra blanks in middle › “ a ” becomes “a” › Very useful when determining if strings equal › Or just eliminating extra whitespace Exercise: test equivalence
Proper – Every word starts with a capital letter CAREFUL! “it’s” will become “It’S” How to fix? › Find the ‘ › Fix the next character Let’s do it!
1. Process each format › Okay to have errors in intermediate steps › BECAUSE you can hide them 2. Determine which format and select it 1. Identify the format that has a unique characteristic 2. If not that one, what is a unique characteristic for one of the remaining options 3. …
Possible formats › Last, First › Last, First M › Last, First Middle › First Last › First M Last › First Middle Last › Last