Searching for words in a list!

hi
i need some help, i have to search for three words in a list then if this list contains these three words it would do something, could anyone help me just to try and start this.

public void checkWord() {
         String word1="1stWord";
         String word2="2ndWord";
         String word3="3rdWord";
         boolean w1,w2,w3;
         w1=false;
         w2=false;
         w3=false;
         ArrayList list=new ArrayList();
         list.add("1stWord");
         list.add("2ndWord");
         list.add("3rdWord");
         list.add("4thWord");
         Iterator i=list.iterator();
         while(i.hasNext()) {
                   String listValue=(String)i.next();
                   if(listValue.equals(word1)) w1=true;
                   else if(listValue.equals(word2)) w2=true;
                   else if(listValue.equals(word3)) w3=true;
         if(w1&&w2&&w3) {
                   System.out.println("All Matched");
}Will it work?

Similar Messages

  • Unable to search for words in a pdf document

    I am using Adobe Reader Ver 10.1.1 (All updates)
    I have a pdf document in which I am unable to search for words. No words in the document are found even though they do exist. If I copy a word from within the document and paste it into the search criteria then instead of getting the word that I copied, I get substitute characters and it can in fact find these characters as the word being searched.
    The document is a catalog and can be downloaded from the following URL.
    http://www.carbatec.com.au/getcatalogue?zenid=d1cuvbat0ois0g37r0r33vnah1
    I will appreciate any help as to why I cannot search for words in the document.

    Thank you Dave Merchant and try67 for your responses. As per my previous post, I contacted the company re the catalogue and they have responded favourably. I'll include their response because it gives the reason for the search failure as document compression which you might find interesting. I'll await their new catalogue and see if they have fixed the problem.
    Company response:
    Thank you very much for your input.  And yes, you are correct, the compression we used for the current catalogue's PDF format does strip out text included in the catalogue.  We used the compression settings we did with the intention of minimising download time, however I take your point about including text for search purposes (which I also utilise when I'm scanning through PDFs).
    We will actually be posting out our new catalogue next week and we'll release the new PDF version on the website at the same time.  I've asked our graphic designer to ensure that the PDF we use for the new catalogue includes searchable text.

  • Can't search for words anymore after saving PDFs in Preview

    Hi everyone,
    I would love to use Preview for my day-to-day use of previewing PDFs + highlighting + setting annotations. However, once I have saved the pdf with Preview I can not search for words anymore. If I search for one letter only, I would get cryptic hits like "7;%! 2%8%P%8!".
    I am not sure, but I guess when preview saves the pdf using a Quartz PDF context, something happens with the index, or the underlying the font structuring.
    Does anyone have had experience with these kinds of troubles?
    Thanks in advance,
    Heinrich

    Hi, thanks for answering quickly, and the heads up on that other thread.
    It undoubtedly has to do with the annotations or mark ups (the last, in my case).
    In the linked-to thread they end by suggesting that it's because it's has "commenting not allowed" when you see it
    using Adobe Reader, File > Properties > Security says Commenting: Not Allowed.
    However, some documents with "commenting not allowed set in Adobe Reader I can highlight or annotate fine, without it messing up after saving.
    Besides, any document I save as pdf even from Word, will say commenting not allowed in Adobe Reader. So if even my own documents are not highlight- or annotate-able without garbling the text, what documents would these functions be for, then?
    I think what somebody mentioned in the other thread about character encodings hold some truth, I see it in documents in Danish with æ ø and å (however, not all!), but not in English-only docs (yet. Have any of you?).
    Thanks in advance,
    - Alexander

  • I need autocomplete  for search for words in a txt. file

    i am not so good in java.
    I have a running code for search in text with a txt. file (from user bluefox815).
    But I need a solution with autocomplete for search for words in a txt. file.
    test_file.txt (Teil des Inhaltes):
    Roboter robots
    Mechatronik mechatronics
    and so on
    Can you help me please.
    Here is the code:
    import javax.swing.*;
    import java.awt.*;
    import java.awt.event.*;
    import java.io.*;
    * this program searches for a string in a text file and
    * says which line it found the string on
    public class SearchText implements ActionListener {
    private String filename = "test_file.txt";
    private JFrame frame;
    private JTextField searchField;
    private JButton searchButton;
    private JLabel lineLabel;
    private String searchFor;
    private BufferedReader in;
    public SearchText() {
    frame = new JFrame("SearchText");
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    searchField = new JTextField(80);
    searchButton = new JButton("Search");
    // this is used later in our actionPerformed method
    searchButton.setActionCommand("search");
    // this sets the action listener for searchButton, which is the current class
    // because this class implements ActionListener
    searchButton.addActionListener(this);
    lineLabel = new JLabel("nach dem Fachbegriff suchen");
    public void createGUI() {
    JPanel topPanel = new JPanel();
    topPanel.setLayout(new BoxLayout(topPanel, BoxLayout.X_AXIS));
    JPanel bottomPanel = new JPanel();
    JPanel mainPanel = new JPanel();
    mainPanel.setLayout(new BoxLayout(mainPanel, BoxLayout.Y_AXIS));
    topPanel.add(searchField);
    topPanel.add(searchButton);
    bottomPanel.add(lineLabel);
    mainPanel.add(topPanel);
    mainPanel.add(bottomPanel);
    frame.getContentPane().add(mainPanel);
    frame.pack();
    frame.setVisible(true);
    public void actionPerformed(ActionEvent e) {
    // now we get the action command and if it is search, then it is the button
    if ("search".equals(e.getActionCommand())) {
    searchFor = searchField.getText();
    searchTheText();
    private void searchTheText() {
    // I initialize the buffered reader here so that every time the user searches
    // then the reader will start at the beginning, instead of where it left off last time
    try {
    in = new BufferedReader(new FileReader(new File(filename)));
    } catch (IOException e) {
    String lineContent = null;
    int currentLine = 0;
    // this will be set to true if the string was found
    boolean foundString = false;
    while (true) {
    currentLine++;
    // get a line of text from the file
    try {
    lineContent = in.readLine();
    } catch (IOException e) {
    break;
    // checks to see if the file ended (in.readLine() returns null if the end is reached)
    if (lineContent == null) {
    break;
    if (lineContent.indexOf(searchFor) == -1) {
    continue;
    } else {
    lineLabel.setText(String.valueOf(lineContent));
    foundString = true;
    break;
    if (!foundString)
    lineLabel.setText("Es kann kein Fachbegriff gefunden werden.");
    try {
    in.close();
    } catch (IOException ioe) {
    public static void main(String[] args) {
    SwingUtilities.invokeLater(new Runnable() {
    public void run() {
    new SearchText().createGUI();
    }

    Markus1 wrote:
    But I need a solution with autocomplete for search for words in a txt. file.What is your question? What have you tried so far? What are you having difficulty with?
    Mel

  • PDF Search: Escape chars / search for words containing dots

    Hello,
    i'm trying to do a search for ip adresses in a pdf document - eg for "10.100.0.1" - but it seems that adobe reader doesnt cope with the included dots.
    Is there a way to search for words containing dots? Maybe some way of escaping the dot?
    Thanks,
    Moritz

    Reader can find dots just fine. There's probably something going on with your file, like font issues or spaces between the text, or something like that.

  • How to do complex file search for "word" unknown characters "word" .file extension?

    How to do complex file search for "word" unknown characters "word" .file extension?

    Using spotlight in Finder helps. Do you know how to search for files in Finder?

  • Do you know a reader app in which I can search for words?

    Do you know a reader app in which I can search for words? I mean which can open .doc files and i can search for specific words in the full text! Thanks!

    I am not aware of any such fix.  If you are concerned, apply a screen protector.

  • Searching for words in Album names

    My iPhoto search function is unable to find words that are in the names of newly-created Albums. It can find words in the names of albums I created some time back but not in new one.
    This is what I do:
    1) Select several photos.
    2) Push the plus sign to create a new album.
    3) Give the album a unique name like "dazzler"
    4) Select the tab to view all photos in the library.
    6) Do a search for "dazzler", but nothing comes up.
    Very strange.
    If I search for words in libraries I created a week ago, they show up fine.
    I've already reindexed Spotlight, restarted, and tried various other general things, all to no avail. Any advice would be appreciated.
    Thanks,
    Matthew

    I can confirm your problem. Report the bug at http://www.apple.com/feedback/iphoto.html as will I.
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto (iPhoto.Library for iPhoto 5 and earlier) database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    I've created an Automator workflow application (requires Tiger), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. It's compatible with iPhoto 6 and 7 libraries and Tiger and Leopard. iPhoto does not have to be closed to run the application, just idle. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.

  • Need to search for words with similar meaning

    HI,
    I want to search for words which are similar in meaning,
    for example, search with the keyword LIME should give LIME , LEMON etc.
    Can it be done using the inbuilt thesaurus?

    I don't know how similar the example that you provided is to your actual problem.  Synonyms are not the only relations that you can set.  You an also use related terms and hierarchies using broader and narrower terms.  In the following example, I have created citrus as a broader term and created lemon, lime, and orange as narrower terms underneath citrus.  I have them demonstrated how you can query to return all items from the same category that lemon is in, by first finding the broader term citrus above it, then searching for all narrower terms underneath that.  I have included some intermediary results that you don't need to run, just for better understanding of how the query is formed.
    SCOTT@orcl12c> create table test_tab
      2    (test_col  varchar2(60))
      3  /
    Table created.
    SCOTT@orcl12c> insert all
      2  into test_tab values ('lemon')
      3  into test_tab values ('lime')
      4  into test_tab values ('orange')
      5  into test_tab values ('toaster oven')
      6  select * from dual
      7  /
    4 rows created.
    SCOTT@orcl12c> create index test_tab_idx on test_tab (test_col) indextype is ctxsys.context
      2  /
    Index created.
    SCOTT@orcl12c> begin
      2    ctx_thes.create_thesaurus ('test_thes');
      3    ctx_thes.create_relation ('test_thes', 'lemon', 'bt', 'citrus');
      4    ctx_thes.create_relation ('test_thes', 'lime', 'bt', 'citrus');
      5    ctx_thes.create_relation ('test_thes', 'orange', 'bt', 'citrus');
      6  end;
      7  /
    PL/SQL procedure successfully completed.
    SCOTT@orcl12c> variable g_search varchar2(100)
    SCOTT@orcl12c> exec :g_search := 'lemon'
    PL/SQL procedure successfully completed.
    SCOTT@orcl12c> select ctx_thes.bt (:g_search, 1, 'test_thes') from dual
      2  /
    CTX_THES.BT(:G_SEARCH,1,'TEST_THES')
    {LEMON}|{CITRUS}
    1 row selected.
    SCOTT@orcl12c> select 'nt(' ||
      2            replace (ctx_thes.bt (:g_search, 1, 'test_thes'), '|', ', 1, test_thes)|nt(')
      3            || ', 1, test_thes)'
      4  from  dual
      5  /
    'NT('||REPLACE(CTX_THES.BT(:G_SEARCH,1,'TEST_THES'),'|',',1,TEST_THES)|NT(')||',
    nt({LEMON}, 1, test_thes)|nt({CITRUS}, 1, test_thes)
    1 row selected.
    SCOTT@orcl12c> select * from test_tab
      2  where  contains
      3            (test_col,
      4            'nt(' ||
      5            replace (ctx_thes.bt (:g_search, 1, 'test_thes'), '|', ', 1, test_thes)|nt(')
      6            || ', 1, test_thes)') > 0
      7  /
    TEST_COL
    lemon
    lime
    orange
    3 rows selected.

  • Search for word/phrase by ctrl+shift+F

    ctrl+shift+F
    One can enter here  the file/folder path the search for word/phrase should be made.
    But length of this control element is really limited.
    If the chosen path is very long, with lot of folder levels, longer than the control element is capable to show it,
    the path string is truncated. Truncation in its middle part.
    Nobody is able to see how exactly the path is, after it has been shortened.
    And now, please imagine that there are several similar paths on the disc.
    They differ by theirs middle section only.
    Now assume the search needs 3 hours.
    1. After 3 hours of search run user can't say which folder of all similar folders he has chosen for last search operation.
    After search completes user is no able to check, which path the search ran in.
    2. If new search in some other folder but in a folder located close to the previous one is aimed  the user
    has to follow the whole path from the disc root - job intensive task.
    Adobe Reader should use the previous search path as start point of new search path selection.
    The full-feature product Adobe Acrobat probably also affected.

    Hi vmartin01,
    I tried to check at my end and it works fine at my end.
    Regards,
    Ajlan Huda.

  • In Pages document, how do I search for word and view its frequency and page numbers in a sidebar?

    I have a long document and I want to be able to search for certain key words and phrases, and then see how many times they appear in the document and exactly where.  How do I conduct this sort of search and viewing?  In the past, in Pages and Word, I've been able to view my "finds" in a sidebar but I can't figure out how to activate that service anymore.
    Thanks!

    Here is a word frequency concordance Automator Service that works in both versions of Pages. It does not present a page number reference. It is by descending count, and alphabetically, within the repetitive counts as shown in the image here. In any document, you select the text to process, then Menu > Application Name > Services > Frequency. The Service will open TextEdit with the n-pages of scrollable results. It is 16 pt Helvetica Neue for legibility.
    Here is the code:
    on run {input, parameters}
         try
              set mySelection to input as text
              set formatted_result to concordance(mySelection)
              if formatted_result is not null then
                   set textHeading to "Word Frequency List"
                   tell application "TextEdit"
                   activate
                         set NewDoc to make new document with properties {name:"Concordance"}
                         make new paragraph at beginning of text of NewDoc with data textHeading & return
                         make new paragraph at end of text of NewDoc with data formatted_result
                         tell text of NewDoc
                               set font to "Helvetica Neue"
                               set size to 16
                               set color of paragraph 1 to {0, 0, 65535}
                         end tell
                        end tell
              else
                        display dialog with title ¬
                         "No input selected" with icon stop ¬
                          giving up after 15
              end if
         on error errmsg number errnum
                    display alert ¬
                               "AppleScript Error" message errmsg & "[" & errnum & "]" as critical ¬
                                  giving up after 30
         end try
         return input
    end run
    on concordance(mySelection)
    -- Use Ruby to count word frequency and alphabetically sort words
        set rb to ¬
        "selected = String.new\nfreqs = Hash.new(0)\nselected = ARGV.join('  ').gsub(/[,.]/, \"\")\n
         words = selected.split(/[^\\w-]+/)\nwords.each { |word| freqs[word] += 1 }\n
         freqs_sorted = freqs.sort do |a,b|\n\t
         a.last == b.last ? a.first <=> b.first : b.last <=> a.last\nend\n
         freqs_sorted.each { |k,v| printf \"[ %8s ]          %s\", v, k }"
        do shell script "/usr/bin/ruby -e " & rb's quoted form & space & mySelection's quoted form
    end concordance
    Launch /Applications/Automator and choose New Document, then click the Service icon, and then select the Choose button.
    On the left, you will have a list of Libraries from which to choose workflow items. Find Library > Utilities. In the adjacent column, locate the Run Applescript workflow. Click on it, then drag and drop it in the large workflow window to your right.
    At the top, you can select Service receives text in any application. Leave Output replaces selected text unchecked.
    In your Run AppleScript workflow window, you will see AppleScript boilerplate. Click on it and press command+A, then backspace to delete this content. Copy and paste the above code into this Run AppleScript workflow window. Press the Run button in Automator's upper right corner. If (and it should) a TextEdit window pops up, you are good, and you want to press File > Save. A dialog box will pop-up where you can name your Service. I called my Frequency, you may wish to call it something else. Once you have save it, you can exit Automator. Services are deposited in yourlogin directory/Library/Services.
    If you have a Pages document open with text, either select it, or command+a to select the entire document. Now, you select your Service via Pages > Services > Frequency. This will now pop-up a new TextEdit document with the results. If you want to save this new document, you must use option+File to Save as...

  • How to search for words in a string?

    I have a list of strings that I need to search for instances
    of a certain word (or part of that word) is there a way of doing
    this in flash please?

    Quickest and easiest way to do it is to search through an
    array of manually entered words.

  • How to search for words in binaries (jpg,bmp,tif,...) ??

    Hello,
    is it possible to index words from images with tenable effort ?
    We are developing a document-management-system and it would be nice
    when search includes images.
    I would appreciate very much any suggestions, links or solutions.
    regards,
    Tim

    >
    Do you mean words in images in the sense of an image
    comment (which is not visible when the image is
    displayed, but some image editors can detect and
    expose as an image property), or as text displayed as
    part of the image, like this:
    http://developer.java.sun.com/images/v4_java_sun_com.gi
    If the latter, forget it.Hello,
    first thanks for answers, I was looking for a possibility to search for text in images in order to save it in a database.
    So its the latter :(
    I thought it could be possible to use any scanner-drivers for this purpose:
    http://www.openarchive.com/echive_tifindexer.htm
    But I'm not sure how to achieve this.
    regards,
    Tim

  • Finder does not display icon for word / excel in list view

    Hi,
    I got a new macbook air, with Yosemite pre installed. I copied over all my files (from my old macbook using a USB drive) and next I installed MS office for mac.
    For some reason Finder does not display the correct excel of word icon in list view (I set preview thumbnail to NO in view options), but it it displays the generic file icon.
    It appears to be very random, as some files do display the icon and others do not. It also appears to have nothing to do with the doc/docx xls/xlsx variations.
    Also some of my parallels icons do not display correctly in list view.
    When I open a INFO panel, it does show the correct icon. Example below:
    Any body know how to reset / fix this ?

    Still got no solution...
    There has to be some one that knows about this ..?
    Any professionals reading this that can point in some direction for a solution?

  • CONTAINS and searching for words with an apostrophe

    I have a CONTEXT index in place, and I'm trying to search for the word
    JOHN'SHow do you go about going that, I tried both
    JOHN'S
    JOHNSand neither worked.
    --=Chuck

    How are you doing your search?
    SQL> create table test1 (
      2  a1 number,
      3  a2 varchar2(20));
    Table created.
    SQL> insert into test1 select level, 'Line '||level from dual connect by level < 500;
    499 rows created.
    SQL> insert into test1 values (1000, 'JOHN''S');
    1 row created.
    SQL> create index context_index on test1 (a2) indextype is ctxsys.context;
    Index created.
    SQL> select * from test1
      2  where contains (a2, 'JOHN''S') > 0;
            A1 A2
          1000 JOHN'S
    SQL> select * from test1
      2  where contains (a2, 'JOHNS') > 0;
    no rows selected
    SQL> select * from test1
      2  where contains (a2, 'JOHN') > 0;
            A1 A2
          1000 JOHN'S

Maybe you are looking for