CSci 151                                                             Spring 2015

               Practice Exercise:  String Manipulation
               
               
String:  a vector of zero or more characters, enclosed within quotation marks.
    
General Form:
   string stringName [ = "string value" ];
   For example:  string place = "commerce";

1. Output the contents of the string named place.



2. Output [only] the first letter of the variable named place. Hint: reference
   a particular position in place by appending brackets surrounded by an
   index number (e.g. place[2] ).



3. Have the object named place invoke length() to compute the number of 
   characters assigned to place. Hint: invocation is expressed by having an
   objectName followed by the dot operator and the function name. 



4. Output the last character value in place. Hint: because string elements are 
   referenced relative to 0, place.length() - 1 would point to the last 
   character.
    
    
    
5. Change the first letter in place to upper case. That is, call toupper() with
   the argument place[0]. Note that toupper( ) may need the header file cctype.



6. Output each letter assigned to the variable place separated by a space. 




7. Output the letters stored in place in reverse order.




8. Assign to place the string "Commerce", and concatenate to place a comma
   and a space, and to that result the string "Texas".
   
   
   
   
9. Assign to an int named commaPlace the value returned as a result of the 
   object named place invoking find(str, pos) to locate the comma(",") between
   the city and state substrings. Note: "str" is an abbreviation for string
   variable and "pos" for starting position.



10. Have place invoke substr(pos[,len]) with the returned string value assigned
    to a variable named state. Note "pos" may be inferred from the commaPlace 
    value.