This week's book giveaway is in the Kotlin forum.
We're giving away four copies of Kotlin in Action and have Dmitry Jemerov & Svetlana Isakova on-line!
See this thread for details.
Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Accepting user input through JOptionpane?  RSS feed

 
John Sing
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I am working on a school project and I am very confused on how to do something for the project. I need to accept and break down a delimited string. At first I did this using the following code

Now this code actually works but I found out I need to break down the information using JOptionpane and actually have the user input it. Also I am not aloud to use the scanner class. So yeah I am not exactly sure how to convert my program to work through JOptionpane. Although I do know how to accept user input through JOptionpane. Here is some code that I wrote for a different project that needs to accept user input

So its just the part where I have to break down the string that is confusing me. Here is what I have to do for the project exactly

"Write a Java program that performs the following tasks:
Asks the user to input their chosen delimiter
Asks the user to input the delimited string, which holds a person’s name and address, as input
Prints a mailing label as output.

Sample: Input: “Jose Reyes:13-07 Estates Lane:Bayside, NY 11360”
Output (may be through the Console window):
-----------------------
Jose Reyes
13-07 Estates Lane
Bayside, NY 11360
-----------------------"
 
Sam Knowski
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Have a look at String Split.

Here's an example somewhat similar to what you're doing:
 
John Sing
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sam Knowski wrote:Have a look at String Split.

Here's an example somewhat similar to what you're doing:


Thank you so much This really helped me out.
 
Campbell Ritchie
Marshal
Posts: 55680
161
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And, Sam Knowski, welcome to the Ranch
 
Sam Knowski
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:And, Sam Knowski, welcome to the Ranch


Thanks!
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!