Results 1 to 4 of 4
Thread: Strings
- 09-07-2012, 06:32 PM #1
Member
- Join Date
- Sep 2012
- Posts
- 1
- Rep Power
- 0
Strings
Hello everyone!
I am new to Java and I am trying to learn it by myself along with taking a class for it.
I have a question about strings
I am trying to write a small program that takes two strings from using input (lets call them String a and String b) and compare them.
An example of how I am trying to compare would be:
String a= CATSATONTHEMAT String b= AT and I need to output to be how many times "AT" appears in String a
Is that the string compare function? I have tried setting up a for loop with a counter, but was unsuccessful.
I do not want someone to just give me code that works, just some suggestions that might help me get to the correct line of thinking.
Any help would be awesome
Thank you
- 09-07-2012, 07:02 PM #2
Re: Strings
Please go through the Forum Rules -- particularly the third paragraph.
Also see Guide For New Members and BB Code List - Java Programming Forum
dbWhy do they call it rush hour when nothing moves? - Robin Williams
- 09-07-2012, 07:43 PM #3
- Join Date
- Sep 2008
- Location
- Voorschoten, the Netherlands
- Posts
- 11,601
- Blog Entries
- 7
- Rep Power
- 17
Re: Strings
You have to read the API documentation; (this link is for version 1.6; google for version 1.7). In the String API it suggests to use the indexOf( ... ) method.
kind regards,
JosWhen people rob a bank they get a penalty; when banks rob people they get a bonus.
- 09-07-2012, 08:14 PM #4
Re: Strings
Also posted at: Need help with what I think should be a for loop
If you don't understand my response, don't ignore it, ask a question.
Similar Threads
-
need help with strings
By iron_fist in forum Java AppletsReplies: 10Last Post: 02-15-2012, 05:16 PM -
Strings
By leepikamukharji in forum New To JavaReplies: 12Last Post: 04-18-2011, 01:43 PM -
Need help with Strings
By </3java in forum New To JavaReplies: 24Last Post: 02-17-2011, 05:00 PM -
Strings
By zoala001 in forum Java AppletsReplies: 9Last Post: 01-02-2011, 10:26 AM -
It is possible in Strings..?
By mlibot in forum New To JavaReplies: 1Last Post: 03-12-2010, 05:30 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks