Fedora Linux Support Community & Resources Center

Go Back   FedoraForum.org > Community Lounge > Wibble
FedoraForum Search

Forgot Password? Join Us!

Wibble A place to have a sensible chat, about anything non linux related. Please remember that political and religious topics are not permitted.

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 26th November 2005, 06:01 AM
limys's Avatar
limys Offline
Registered User
 
Join Date: Nov 2005
Location: Singapore
Age: 26
Posts: 22
indexOf() question

Hello everyone, i'm juz started learning java programming and i'm having a problem with my code for my project.

i cannot understand y my indexOf() returns me 2 result..

here is a example:

String ys = "</book><book></book>";

if(ys.indexOf("<book>", 0) != -1){
System.out.println("Valid");
} else {
System.out.println("Invalid");
}

the result i get is:

Valid
Valid



How come it print out twice?
Reply With Quote
  #2  
Old 28th November 2005, 05:45 PM
BandC's Avatar
BandC Offline
Registered User
 
Join Date: Nov 2004
Posts: 1,105
First, it'd be better if you posted this in the programming forum. I tested your code and it prints Valid only once. Maybe you have this code in a loop or something so it gets executed twice.
__________________
IMHO GNOME FTW! BTW KDE WAD? FWIW. HTH. AFAIK YMMV. OMG WTF BBQ! :rolleyes:

Do you like surfing forums but wish people would stop using obscure abbreviations and acronyms?
Then my Firefox/Chrome extension ABBREX is for you!
It automatically adds hover tooltips to abbreviations displaying their meanings on any web page you visit!

Check it out at: http://abbrex.com
Reply With Quote
  #3  
Old 30th November 2005, 12:57 AM
limys's Avatar
limys Offline
Registered User
 
Join Date: Nov 2005
Location: Singapore
Age: 26
Posts: 22
okies.. i got it.. thks
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
/tmp/ question comptech520 Using Fedora 2 25th October 2007 04:57 PM
Question on XGL - It works, so not install question Vapour Using Fedora 1 30th October 2006 05:10 PM
Grub question and Login (init 3 or 5) question Anla-shok Using Fedora 2 11th June 2006 10:35 PM


Current GMT-time: 01:42 (Thursday, 23-05-2013)

TopSubscribe to XML RSS for all Threads in all ForumsFedoraForumDotOrg Archive
logo

All trademarks, and forum posts in this site are property of their respective owner(s).
FedoraForum.org is privately owned and is not directly sponsored by the Fedora Project or Red Hat, Inc.

Privacy Policy | Term of Use | Posting Guidelines | Archive | Contact Us | Founding Members

Powered by vBulletin® Copyright ©2000 - 2012, vBulletin Solutions, Inc.

FedoraForum is Powered by RedHat