• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

Accepting user input through JOptionpane?

 
Ranch Hand
Posts: 58
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
-----------------------"
 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Marshal
Posts: 76395
364
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And, Sam Knowski, welcome to the Ranch
 
Sam Knowski
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:And, Sam Knowski, welcome to the Ranch



Thanks!
 
Yes, of course, and I accept that blame. In fact, i covet that blame. As does this tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic