String Manipulation

Document Sample
String Manipulation Powered By Docstoc
					       IB103 Week 3
String Arrays & Processing
         Chapter 15
              String Arrays
• An example:

• String cities[] = new String[10];
                       // array of strings

• cities[0] = “London”;
Enter data, save and display
      String parameters (p289)
• Rewrite doubleIt so that it works and
  demonstrate it (p290)
• private void doubleIt (String any) {
                      // should be what?
• any = any + any;
                      // should be what?
• Because a String parameter is unchanged
     Mobile Phone Case Study
• 3 Case Study (Continued)
• Apply the array data structure to the mobile
  phone to create a 'phone book'.
• Tasks
• 3.1 Amend the mobile phone program so
  that up to 5 mobile phone numbers can be
  stored and displayed.
    Chapter Example Program
• AskFraiser
• See Author‟s web site, run program after
  study of code
• Discuss new features
    A note on StringTokenizer class
•   Beyond scope of this module
•   Used for advanced string manipulation
•   Uses delimiters for, eg
•   Transforming file data:
•   “Peter, Chalk, 2394, tb1/1”
•   Is called „comma delimited‟
•   A StringTokenizer can split up data between
    commas – see p287

				
DOCUMENT INFO
Shared By:
Categories:
Tags:
Stats:
views:2
posted:10/3/2011
language:English
pages:7