Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Portage & Programming
  • Search

searching file in java

Problems with emerge or ebuilds? Have a basic programming question about C, PHP, Perl, BASH or something else?
Post Reply
Advanced search
3 posts • Page 1 of 1
Author
Message
readme.txt
Tux's lil' helper
Tux's lil' helper
Posts: 147
Joined: Tue Oct 11, 2005 7:07 am

searching file in java

  • Quote

Post by readme.txt » Wed Oct 04, 2006 9:39 am

I have a word list about 2Mb large. I am writing a program which requires me to search the word list to see if it contains a certain word. If the word is found in the word list the function will return true, otherwise false. For example:

If wordlist.txt contained:
  • ...
    foo
    bar
    blah
    blarg
    ...
..and I did a search on "foo" my program would return true, however if i did a search on "foo2" it would return false.

Thanks.
Top
Cybersorcerer
Apprentice
Apprentice
User avatar
Posts: 193
Joined: Tue Mar 30, 2004 3:14 pm
Location: somewhere over the rainbow

  • Quote

Post by Cybersorcerer » Wed Oct 04, 2006 12:10 pm

eehhm and where is the beef ?
greetings

Cybersorcerer
--
Too old to die young

Dell Precision M90, Intel Centrino Duo T2700 @ 2.33GHz running Jackass! 2006.2
Top
jonnevers
Veteran
Veteran
User avatar
Posts: 1594
Joined: Thu Jan 02, 2003 6:59 pm
Location: Gentoo64 land

Re: searching file in java

  • Quote

Post by jonnevers » Wed Oct 04, 2006 1:19 pm

readme.txt wrote:I have a word list about 2Mb large. I am writing a program which requires me to search the word list to see if it contains a certain word. If the word is found in the word list the function will return true, otherwise false. For example:

If wordlist.txt contained:
  • ...
    foo
    bar
    blah
    blarg
    ...
..and I did a search on "foo" my program would return true, however if i did a search on "foo2" it would return false.

Thanks.
open the file
read it line by line
if line (list item) matches
close file
return true
repeat until EOF then return false

please refer to Java's online documentation for such simple questions.
Top
Post Reply

3 posts • Page 1 of 1

Return to “Portage & Programming”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy

 

 

magic