Assignment Objectives & Purpose:
- Student's will learn about strings and string operators.
- Student's will learn how to manipulate strings.
- Student's will learn how to use string functions.
- The purpose of the assignment is to create a sentence in a PHP string.
- Student's will then manipulate the string as described below:
Original Sentence String:
" mary jones lives in santa cruz, california at 22 ocean drive."(a.) Length Of String:
There are 66 characters (including white space) in the sentence.
(b.) Capitalize Each Word in the String:
" Mary Jones Lives In Santa Cruz, California At 22 Ocean Drive."
(c.) Change Back To Lower-Case:
" mary jones lives in santa cruz, california at 22 ocean drive."
(d.) Find & Print "Santa Cruz, California" (with Capitals):
Santa Cruz, California
(e.) Print Out the Street Address of the String:
Street Address: 22 ocean drive.
There are 66 characters (including white space) in the sentence.
(b.) Capitalize Each Word in the String:
" Mary Jones Lives In Santa Cruz, California At 22 Ocean Drive."
(c.) Change Back To Lower-Case:
" mary jones lives in santa cruz, california at 22 ocean drive."
(d.) Find & Print "Santa Cruz, California" (with Capitals):
Santa Cruz, California
(e.) Print Out the Street Address of the String:
Street Address: 22 ocean drive.
(f.) Trim White Space From Beginning Of String:
"mary jones lives in santa cruz, california at 22 ocean drive."
New Length: Now the string only has 61 characters!
(g.) Find the Index Postion of 'California'.
The index position of 'California' is: 37
(h.) Replace "Santa Cruz" with "Los Altos":
mary jones lives in Los Altos, california at 22 ocean drive."
(i.) Find the Word Count in the String:
The number of words in the sentence is 10
"mary jones lives in santa cruz, california at 22 ocean drive."
New Length: Now the string only has 61 characters!
(g.) Find the Index Postion of 'California'.
The index position of 'California' is: 37
(h.) Replace "Santa Cruz" with "Los Altos":
mary jones lives in Los Altos, california at 22 ocean drive."
(i.) Find the Word Count in the String:
The number of words in the sentence is 10