How to search a word in a 2d array

Hi, i'm seeking advice on how to search a word in 2d array. The method will only taking one argument string and will search in row by row, column by column and diagonall down and up. for example, user input String "SEEK" or then the method will have different search pattern to locate the word. Here is the 2d array look like.
S + K E E S + +
E + + + + + + K
E S + + + + + E
K + E + + + + E
+ + + E + + + S
+ + + + K + + +
What i've done so far is;
// this loop is for search SEEK column by column
public boolean finder(String w){
for(int j = 0; j < puzzle[0].length; j++) {
for(int a = 0; a < w.length(); a++) {
char n = w.charAt(a);
String r = String.valueOf(n);
if (puzzle[0][j] != w.charAt(a)) {
return false
} else {
return true;

read this

Similar Messages

  • How to search a word in string

    hi all
    tstxt = 'mnr ptds xyz king fox'.
    i want to make a condition..like
    if tstxt contains king.  *
    execute statement.
    endif.
    how can i search the word in string

    Hi,
    You can search like this
    if tstxt CS 'king'. "CS stands for Contains String a relational operator.
    *Execute here
    endif.
    Regards,
    Sesh

  • How to search a word and its page in Acrobat 6.0 using vb6.0

    Hi all,
    I would like to search a word and its corresponding page number in my PDF document. The word may be occur in many of the pages and i have to collect all the page numbers and need to create bookmark for all of them.
    Eg: The word "Chennai" can be found in the pages 5, 6, 7 and10. Then I need to create bookmarks Chennai1 - Page 5, Chennai2 - Page 6 and so on...
    I have tried this with Acrobat 7.0 professional and it was working fine. But in 6.0 Professional i am not able to collect all the pages. Below I have given the code that i have used.
    Dim objFind As Acrobat.CAcroAVDoc
    Set objFind = CreateObject("AcroExch.AVDoc")
    Do While objFind.FindText("MyText", 0, 1, False)
                    Dim objPageView As Acrobat.CAcroAVPageView
                    Set objPageView = objFind.GetAVPageView
                    strPageNo = objPageView.GetPageNum + 1
                    If strPageNo = strPrevPageNo Then
                        intIncremental = intIncremental + 1
                    Else
                        intIncremental = 0
                    End If
                    If intIncremental > 50 Then
                        Exit Do
                    End If
                    If Val(strPageNo) < Val(strPrevPageNo) Then
                        Exit Do
                    End If
                    strPrevPageNo = strPageNo
    Loop
    Thanks in advance,
    Dhanasekaran. G

    Adobe no longer supports Acrobat 7 or earlier.

  • 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

  • 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 documents in Lion

    Here's why I'm trying to ask.
    Lately I have downloaded a lot of files from Google Drive, and I'm trying to sort a lot of documents (262 exactly) by finding a set of numbers and letters that only one kind of document has.
    For example, I'm trying to find the documents that have "5R-ET1" to see which documents has those set of letters inside the documents to sort them in a diffrent folder.
    Is there something in the Finder that can allow me to do this, or is there like this program which compares documents that fits my use?
    By the way, most of the files are in .doc format, the rest are in .pages format.
    Hope there is a way to fix this situation!

    Open to correction here but I don't think Spotlight will do this for you, particulary if these are long documents. Spotlight does not index then entire document, just the first 2k approx unique terms within a document. If the string you're looking for isn't within that limit then it won't work.
    Options:
    1. You could import the documents to an app like DevonThink Pro or Circus Ponies Notebook that have a concordance feature.
    2. You could convert the files to Text and search them with BBEdit or the grep command.
    http://hints.macworld.com/article.php?story=20001105214242629

  • How to search a word in PDF using acrobat javascript?

    Hi,
    I need to find a word in acrobat PDF using javascript. I used
    find text("abx");
    select text("abx");
    This doesn't work for me..
    Someone guide me.
    Thanks in advance,
    Poovili V

    I used
    find text("abx");
    select text("abx");
    This doesn't work for me..
    That is not Acrobat Javascript. In the Acrobat Javascript Reference look for the method getPageNthWord.

  • How to search for specific match from an array?

    Hi Mike,
    Thanks for the reply.
    I am reading a position of switches whether ON/OFF. It is nothing but the digital inputs status from the field. I am Indexing that array, and connect it to the LED indicators to show the relevant status. Also I want to raise an alarm  once, for the ON switches.  By using Search 1D array, I got the first TRUE match index from the array. But if I want to know all the occurrences of ON condition (TRUE from an array of booleans) from an array of switches. How to do that?
    Hope this clarifies.
    Thanks
    Kousy

    I almost missed this message because you started a new thread.
    In any case, the code altenbach posted will give you an array of the indexes that are set to true. So it sounds like that is at least part of what you want. The alarm you mention, is that one "master" alarm if any of them are true, or is it a separate alarm for each bit?
    If it is one "master" alarm for all of them the logic menu has a function for ORing all the elements in a boolean array. Also when you say "alarm" what is the nature of this alarm? A dialog box? a flashing light (real or on the applications's front panel)? message in a status display?
    The attached code shows one possible direction by adding onto altenbachs code the ability to accumulate a single error message based on the states of individual bits. (BTW: The other alternative that you might see would be to pass the array into a loop and use a case to append a message of the bit is true. The advantage of the one in the combined VI is that the loop only iterates for the number of true bits +1. Where as the other approach would have to look at all the bits one at a time.)
    In a sense this is why I asked for clarification because there are a lot of things you can do when parsing an array like this.
    Mike...
    Certified Professional Instructor
    Certified LabVIEW Architect
    LabVIEW Champion
    "... after all, He's not a tame lion..."
    Be thinking ahead and mark your dance card for NI Week 2015 now: TS 6139 - Object Oriented First Steps
    Attachments:
    TRUEadditions.vi ‏31 KB

  • IPad version:how can I search a word on modules?

    Hi to everybody! How can I search a word in modules?
    I understand that I can do a search in spreadsheet, but I need to do in a module that is more efficient...so do you know?
    And why when I write on module I can't press enter and begin to write a new line??
    Thanks!

    Touch the URL field at the top of the page, type your word and a list of possible searches will be shown. Near the bottom of this list will be "On this page" which shows hits on the page (if any). Touch this and you will be taken to the first match.

  • I have Adobe Reader XI with the package that allows me to send pdfs and convert pdfs to Word. When I open a pdf and try to search the search shows no matches even though the word I am searching for is in the document. Any suggestions how to search?

    I have Adobe Reader XI with the package that allows me to send pdfs and convert pdfs to Word. When I open a pdf and try to search the search shows no matches even though the word I am searching for is in the document. Any suggestions how to search?

    Once again, my thanks for your assistance. If I may impose on your generosity one more time, if I understand you correctly if I create a document on Word or WordPerfect, print it and scan it to create a pdf, the search function will not work. But, if I create the pdf document in Word the search function will work. Unfortunately, I am not sure how I create a pdf document in Word other than by printing it and scanning it. Could you please explain.
    William B. Kohn, Esq.
    General Counsel
    Paul V. Profeta & Associates, Inc.
    769 Northfield Avenue
    Suite 250
    West Orange, New Jersey 07052
    (973) 325 - 1300
    (973) 325 - 0376 (Facsimile)
    [email protected]<mailto:[email protected]>

  • How can I search a word in a column and erase all the rows containing that word?

    How can I erase all the rows containing a certain word at once?
    Right now I do it manually : I search the word in a certain column with cmd+f, after that it points out where the word is in different rows. And then I manually erase every row but this takes a lot of time when you have 500 row! There must be a way to select all the rows concerned at once and erase them? Thks!

    assuming this is something you don't do very often you can simply use the search feature to identify instances of the search term, and select the row, delete the row then search again.
    The next level would be to add a new column where you identify that the search term exists in a cell of the row, then you sort by the new column:
    B1=IF(IFERROR(FIND("team", A1,1), 0)>0, "FOUND", "")
    my search term is "team" change yours as needed.
    select B1, copy,
    select Column B, paste
    Now sort:
    Inspect the rows to make sure the rows found are REALLY ones you want to remove.  select the ones you want to remove and delete those rows.

  • How to search for a particular word in a string?

    How to search for a particular word in a string?
    thanks for your help....

    This works fine.
    public class Foo {
        public static void main(String[] args) {
        String s = "Now is the time for all good...";
        String s2 = "the time";
        System.out.println(s.contains(s2));
        System.out.println(s.contains("for al"));
        System.out.println(s.contains("not here"));
    }output:true
    true
    falseYou must have something else wrong in your code.
    JJ

  • How to search for a particular word in a long document?

    How to search for a particular word in a long document?

    What program are you using to read the document?
    Good luck.

  • How to search for a word in an email?

    How to search for a particular word in an email in 'Mail'?

    You can't search through email content using buil-in search
    If you're using Gmail, you can use their native Google Mail app which will allow you to search through body content and server-stored emails.

  • 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?

Maybe you are looking for