• Post Reply Bookmark Topic Watch Topic
  • New Topic

parsing a line  RSS feed

 
Mohammad Ashari Rahman
Ranch Hand
Posts: 55
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi I have this line in a file

"AxBrCrAx"....... //like this

I want to know how can I find out how many times "A" occured with "x" and also how man times "r" occurred? any simple solution?

thanks
 
Campbell Ritchie
Marshal
Posts: 56221
171
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sounds simple enough, yes.

But we don't give out complete solutions here. What have you managed so far and how is it working?
 
Winston Gutkowski
Bartender
Posts: 10573
65
Eclipse IDE Hibernate Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mohammad Ashari Rahman wrote:I want to know how can I find out how many times "A" occured with "x" and also how man times "r" occurred? any simple solution?

How simple is simple? But the answer is basically: yes.

However, it starts with two things: a pencil and a piece of paper.

You will never write a good Java program (at least at this stage) unless you can describe the solution on paper and in English (or your native language).

So: How would you find the number of times 'A' occurs with 'x'? (Hint: tackle that first, and treat it separately from finding the number or 'r's)

HIH

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