InClassExercise23 - CS112: In-class Exercise 23 Extracting...

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

View Full Document Right Arrow Icon
CS112: In-class Exercise 23 Extracting words from a sentence and characters from a word 0 . Review of the split method. The split method when applied to a string. .. someString .split( pattern ) will return a String[] object (a true array of String). Here someString is either a String variable or String literal or any String expression. Here the string pattern is a string that gives the pattern of how to break up the string. One type of pattern is to use square brackets to enclose characters that separate words. For example, if we only want spaces to separate words, then can do… someString .split("[ ]") The result must be saved into a String[] variable. For example, String[] wordArray; wordArray = someString .split("[ ]"); 1. Copy the InClass23 folder from the usual locations. 2. Open the project using BlueJ. 3. Note that the Algorithms class is functional (although you do not have the source file). That is, you can use the linearSearch and binarySearch methods from this class. 4.
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

This lab report was uploaded on 04/08/2008 for the course CSCI 112 taught by Professor Yuen during the Fall '07 term at Lake Forest.

Ask a homework question - tutors are online