• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

trapping two appearance of a character

 
joseph okon
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

pls don't laught ! can't think of any stuff to make it work

[fbr - added code tags]
[ December 11, 2007: Message edited by: Fred Rosenberger ]
 
Joanne Neal
Rancher
Posts: 3742
16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by joseph okon:

pls don't laught ! can't think of any stuff to make it work

[fbr - added code tags]

[ December 11, 2007: Message edited by: Fred Rosenberger ]


One error I can see is that you are trying to use equals to compare two integers. Primitive data types (such as int) don't have methods. You need to use == to compare them.

Fix that and if it still doesn't compile, post the error messages you are getting (exactly as they appear). Once it's compiling we can then tackle the logic.
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've made a few modifications -marked in bold- to help you get going. What's missing is the spot labelled "TODO". What needs to happen there to make the code work?
 
Shane W
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
As pointed out by folks above, there are some erroes in your code.Find below a simple piece of code that achieves what your code would have(more than 2 @).I have done away with the countChar method.
Incase you want to count how many times "@" appears,you need to modify countChar method



Shane
 
joseph okon
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks guys, i have gotten the right answer to my code
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic