• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Help me with strings

 
Liza Misra
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I want to check for the number of occurences of a particular character in a string ignoring case.
Is it possible to use equalsIgnoreCase(),meant for strings?
I tried something like:
word1.charAt(index).equalsIgnoreCase('a')
but it gives error (char can not be dereferenced).
Please comment.
Liza
 
Joseph Russell
Ranch Hand
Posts: 290
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'll answer your question but to restate what Marylin already said in your thread about interfaces this question doesn't have anything to do with the Cattle Drive assignments. It would be better for you to put them in Java In General( beginner ).
This might be a little sloppy but it works. I'd appreciate some suggestions as to how to make it look better.

Maybe this should be moved to Java in General? Let me know if it does get moved.
Thanks,
Joe
[This message has been edited by Joseph Russell (edited March 27, 2001).]
 
Marilyn de Queiroz
Sheriff
Posts: 9062
12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
equalsIgnoreCase() compares two Strings ignoring case differences in the two Strings.
But, you could do something like this:

I'm moving this to Java in General (Beginners)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic