• Post Reply Bookmark Topic Watch Topic
  • New Topic

Searching through a String  RSS feed

 
Fred Victa
Ranch Hand
Posts: 206
1
  • Mark post as helpful
  • send pies
  • 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.
 
Gamini Sirisena
Ranch Hand
Posts: 378
  • Likes 3
  • Mark post as helpful
  • send pies
  • 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...
 
Winston Gutkowski
Bartender
Posts: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • 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: 206
1
  • Mark post as helpful
  • send pies
  • 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: 206
1
  • Mark post as helpful
  • send pies
  • 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: 10575
66
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • 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
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!