• 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
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Searching through a String

 
Ranch Hand
Posts: 226
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have a text file that contains the following information:

[seller address1=SOSLRAD1, seller city=SOSLRCTY, seller name=SOSLRNAM, seller state=SOSLRNAM, seller zip=SOSLRZIP]

How would I search through this text file and print out the following?

SOSLRAD1, SOSLRCTY, SOSLRNAM, SOSLRNAM, and SOSLRZIP.
 
Ranch Hand
Posts: 378
  • Likes 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you think how you could do this in non programming talk?

Then you could ask how can I do this or that specific thing.. This way it would be a very getting hands dirty and an enlightening and really enriching experience...
 
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Fred Victa wrote:How would I search through this text file and print out the following?


First: do you know how to read a text file?

If not, then that's where to start.

If you do, then Gamini's advice is spot on: First come up with a description for how you would do this outside Java, and then translate those steps into Java code.

You may find the StopCoding (←click→) and WhatNotHow pages useful.

Winston
 
Fred Victa
Ranch Hand
Posts: 226
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Winston Gutkowski wrote:

Fred Victa wrote:How would I search through this text file and print out the following?


First: do you know how to read a text file?

If not, then that's where to start.

If you do, then Gamini's advice is spot on: First come up with a description for how you would do this outside Java, and then translate those steps into Java code.

You may find the StopCoding (←click→) and WhatNotHow pages useful.

Winston



Yes, I can read a text file. I wrote the description on paper and translated those steps into Java.
 
Fred Victa
Ranch Hand
Posts: 226
1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Gamini Sirisena wrote:Can you think how you could do this in non programming talk?

Then you could ask how can I do this or that specific thing.. This way it would be a very getting hands dirty and an enlightening and really enriching experience...



Thank you. I was able to make a description and write down the steps on paper.
 
Winston Gutkowski
Bartender
Posts: 10780
71
Hibernate Eclipse IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Fred Victa wrote:Thank you. I was able to make a description and write down the steps on paper.


OK, so what is it? Or maybe better: what Java code have you written to translate it? If you show us that, we might be able to help.

Basically, for anything more difficult than "Hello World", your code should be the final step in a long process. It should NOT take most of your time; nor should it be the thing that you start doing to solve a problem. The average professional programmer probably spends 20% of his/her time actually coding (often less), because the rest of it is spent in describing and understanding the problem. And you don't normally need Java for that.

If you're interested, have a look at the WhatNotHow (←click) page. It may help.

Winston
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic