Results 1 to 2 of 2
- 11-04-2007, 04:00 PM #1
Member
- Join Date
- Oct 2007
- Posts
- 11
- Rep Power
- 0
program help: Extracting words from a string
I need to write a program that extracts words from a string using spaces and punctuation marks as delimiters. The string needs to be entered from an input dialog box.
I am lost on this one.
This is what I have so far. Am I close.Java Code:import java.util.*; import javax.swing.JOptionPane; public class Exercise8_17 { /**Main method*/ public static void main(String[] args) { // Receive text entered from the dialog box String s = JOptionPane.showInputDialog( "Enter a sentence using punctuation:"); String delims = "[ .,?!]+"; String[] tokens = str.split(delims); System.out.println("The extracted words are:"); } }
- 11-04-2007, 06:39 PM #2
Similar Threads
-
Extracting words from a string using delimiters
By toad in forum New To JavaReplies: 4Last Post: 07-07-2008, 01:32 PM -
Extracting JAR file
By Java Tip in forum Java TipReplies: 0Last Post: 02-08-2008, 09:17 AM -
Extracting embedded files
By kasturi in forum New To JavaReplies: 0Last Post: 02-07-2008, 12:25 PM -
Analyze a string of words
By zoe in forum Advanced JavaReplies: 2Last Post: 07-26-2007, 10:01 AM -
Extracting data from an XML file...
By techno_brains in forum New To JavaReplies: 1Last Post: 07-15-2007, 05:46 PM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks