How to find a particular word in a textArea

can anyone tell me how to search for a particular words in a textArea that contains hundreds of sentences by ignoring the space. for example i want to search for the word "book"
so far i can detect the words with the space included
if the sentence goes like this
"hello_this_isMy book" the searched words can be found
but if the sentece goes like this
"Hello_this_isMy_booK " the searched words can not be found
.. can anyone pls tell me how to do this.

I though you didn't WANT it to be found, your original post isn't clear
public boolean searchWord(String text, String word){
   boolean wordFound = false; 
   StringTokenizer stkn = new StringTokenizer(text," ");
   while(stkn.hasMoreTokens() ){
      String tmp = stkn.nextToken;
      if(tmp.equals(word)) wordFound = true;
   stkn = new StringTokenizer(text,???);   // fill in the -???- yourself
   while(stkn.hasMoreTokens() ){
      String tmp = stkn.nextToken;
      if(tmp.equals(word)) wordFound = true;
   return wordFound;
}

Similar Messages

  • How to find a particular word in a file using java

    Program how to find a particular word in a file

    SirivaniG wrote:
    Program how to find a particular word in a fileOkay, I finished it. Now what?

  • How to find a specific word in sentence in each line?

    How to find a specific word in sentence in each line and output will show start from the beginning from specific word plus with small description from each sentence?
    For example: I need to find a "+Wednesday+" and "+Thursday+" word in each sentence by line by line from "myfile.txt".
    Go ballet class next Wednesday.
    On the Wednesday is going to swim class.
    We have a meeting on Thursday at Panda's.
    Then it will show the output:
    Wednesday : ballet class
    Wednesday : swim class
    Thursday: meeting at Panda's
    I am going to figure out in Java console to read from a file for specific word from each line and how to make it output in correct way. I know already to make input/file codes.

    I got it and understand much better. Thank you very much. There is a problem with it because I knew how to make
    a specific word in sentence but how I should make Output for specific word and some words from sentence.
    For example:
    Input:
    +"On Thursday go to ballet class"+
    +"Swim class on Friday one time a month at 2 p.m."+
    I used the codes for that:
    class FindSchedule{
         String firstline = "On Thursday go to ballet class ";
         String secondline = "Swim class on Friday one time a month ";
         FindSchedule(){
              System.out.println(firstline + findTheIndex("Thursday", firstline));
              System.out.println(secondline + findTheIndex("Friday", secondline));
         public int findTheIndex(String word, String sentence){
              int index;
              index = sentence.indexOf(word);
              return index;
         public static void main (String[] args){
              new FindSchedule();
    }The output will be:
    Thursday: ballet class
    Friday: 14:00 swim class one time a week
    Notice that time is changing in output complete different from input.
    I need to find out how to extract some words from each sentence for output. Do you know how to do it?

  • How to find the particular record in 1000's of workflow jobs are running

    Hi,
    In a data manager -> in workflow tab>IF a record is in CHECK-OUT MODE there are 1000's of jobs are running in that workflow tab. Can anyone tell me how to find that particular record in that workflow jobs.
    Can anyone show me the difference in getting a record in 5.5 and 7.1

    Hello COTI
    Unfortunatly, SAP MDM doesn't have good ability for  WF search.
    All WF clarify by it's status (unlaunched, avialable, Received, complited, error  etc.)
    For each WF SAP MDM assing unique Job ID and this id will be shown in Job ID field in Data Manager WF Tab.
    You can change WF list order by all WF fields like as Job ID, Step, User, Start etc. and try to find your's WF.
    You can use Java API - this is one of the best solution for WF management and WF mass upload  (for example)
    Regards
    Kanstantsin Chernichenka

  • How to find out particular work item is trigger by particular transaction

    Hi,
    can any one tell how to find out particular work item is trigger by particular transaction. in swfrevtlog we ill get custom obj type and also super business obj type,but i need to identify this work item id is triggered by this transaction. can any one help,
    Thanks in advance

    Hi,
    Sorry, but I don't believe that's possible. Even if you can identify the program, there could be multiple transactions that executed it.
    The only possible way, I think, would be to add an enhancement / badi which uses the callstack to determine the calling transaction at the time he event is raised (and then stores it somewhere).
    But that's not very elegant.
    Why do you need to know the triggering transaction? To influence the workflow? If so, another approach might be this:  pass the transaction code as an additional parameter to the workflow event & then pass that to the workflow.
    cheers
    Paul

  • How to use GREP to find one particular word with automatic hyphen?

    I know I have in my text a word with automatic hyphen on the end of line, say Wo-rd.
    How can I find it?
    Thanks.

    I think you might do better to edit the hyphenation in the Dictionary.
    One reason words hyphenate incorrectly is the wrong language has been applied. Both spell checking and hyphenation rules are governed by the language selected for the text, and language is a character-level attribute so that you can select inidvidual words and assign a different language to them if you like.
    If that's the probelm here, you can look for the word using find/change (without worying about the hyphen) and change the language for all instances.
    In either case you will be far better off fixing the problem on a global scale in the document than you will be finding a particular instance of that word at the end of a line. Any editing you do in the future may cause the problem to reappear somewhere else.

  • How to find out Particular column value in DB

    Hi All,
    I have to find out Particular column value in DB .can U tell me the Query for that.

    There is one way:
    Re: How to write the Query

  • Here's how to find the right word in a string

    I needed to find the rightmost word in a string. I didn't find a simple formula in these forums, but I now have one, so I wanted to share it. Hope you find it useful.
    Assuming that the string is in cell A1, the following will return the rightmost word in the string:
    RIGHT(A1,LEN(A1)-FIND("*",SUBSTITUTE(A1," ","*",LEN(A1)-LEN(SUBSTITUTE(A1," ","")))))

    I found the problem. Whatever character was being used in the substitution was parsed out by the forum parser. I replaced it with "œ" (option q on my keyboard).
    =RIGHT(A1,LEN(A1)-FIND("œ",SUBSTITUTE(A1," ","œ",LEN(A1)-LEN(SUBSTITUTE(A1," ","")))))
    Still needs an error check for a single-word "sentence" and to remove the trailing period but it does seem to work. Pretty slick.
    Message was edited by: Badunit
    I see below that the problem was fixed by the OP.
    Message was edited by: Badunit

  • How to find the exact word in a long text?

    Hi,
    Scenario:
    I have long text containing the system status of the equipment.
    Issue:
    I need to find the exact word from the list of the statuses. I have tried to use the FIND keyword but it does not work for all the cases.
    Example:
              FIND 'REL' IN <status_list> IGNORING CASE.
              if sy-subrc = 0.
              " do something
              endif.
    If the status list contains the word 'RELR', the sy-subrc is set to 0 (which may be because it searches the list based on a pattern) but I want to get the exact match.
    Can anybody suggest me on this.
    Regards
    s@k

    >
    siemens.a.k wrote:
    > Dear Kiran, Vasuki,
    >
    > The data type of status list is char with length 40.
    > The status list:
    >
    > Case 1: list -  REL  MANC NMAT PRC  SETC
    > FIND 'REL ' IN <status_list> IGNORING CASE
    > the sy-subrc is set to 0
    >
    > Case2: list - CRTD MSCP NMAT PRC  RELR SETC
    > FIND 'REL ' IN <status_list> IGNORING CASE
    > the sy-subrc is still set to 0 even though the list does not contain the word 'REL'
    >
    > I have also tried using
    > if <status_list> CS 'REL'
    > and
    > if <status_list> CS 'REL '
    >
    >
    > Please do let me know if I am anyway unclear about issue...:)
    >
    > Regards
    > s@k
    This is becacuse when you check
    > Case2: list - CRTD MSCP NMAT PRC  RELR SETC
    It is having RELR so that is the reason you are getting subrc = 0.
    >Ok try CS it should work perfectly.
    It seems... CS also not the correct answer
    (It will count RELR)  below thread sachin is correct ...Do that way ....
    Regards
    sas
    Regards
    Sas
    Edited by: saslove sap on Jan 25, 2010 6:58 AM

  • How to find out what word doesn't start with a "#"?

    Hi,
    I need to find out the position in the text for the first word that doesn't contain a leading hashtag (#) - starting from the end of the text.
    This is a demo text:
    var demoText:String = "hello world #dontremoveme here #1remove #2removeme #3removeüäüö
    The position would be after the word here.
    How do do that?

    For quick and simple code, you can use String methods to get the character index of the "#". Below is an example that gets the index of the space character that is directly in front of the second "#". This code example assumes you are wanting to create a new String that has everything up to the second "#" character.
    var demoText:String = "hello world #dontremoveme here #1remove #2removeme #3remove";
    var index1:int = demoText.indexOf("#");// find first instance of "#" in the String
    var index2:int = demoText.indexOf("#", index1 + 1) - 1;// find the index of the space character right before the second instance of "#"
    var newText:String = demoText.substring(0, index2);// newText = "hello world #dontremoveme here"
    To explain line 3, you are searching for the index of the "#" character starting the search from the index of the first "#" + 1. The "+ 1" is to have the search start after the first "#" character. If you don't have that, you would keep finding the same index value as "index1". The "- 1" at the end is to decrease the index2 value so it will give you index of the space character directly in front of the "#". Line 4 creates a new String starting from the beginning of the original String up to, but not including, the space character in front of the second "#".
    If you needed something more complicated than just removing everything after "here" then I would need a different example.
    Edit: Here is a link to the AS3 API for the String class. String - Adobe ActionScript® 3 (AS3 ) API Reference

  • How to find a particular cookie?

    I'm having an issue with the LA Times website. I don't normally use it that often, but during March I kept getting directed there via Google for news updates, and I apparently overstayed my welcome, as it started displaying a popup saying my "monthly free limit" of visits had been exceeded and asking me to pay for a subscription. Well, I don't usually visit them very often so a subscription makes no sense. Ergo, I figured I'd just wait until April and the problem would solve itself when the "max monthly free visits" or whatever reset.
    Unfortunately when April came I still found myself staring down the damned subscription popup.
    So I went to my cookies and deleted the "latimes" cookies -- and yet the popup persisted.
    I downloaded and installed Chrome to see what would happen, and using Chrome I can visit the LA Times web site without a problem and read news articles. Ergo, whatever is causing the "pay up!" popup resides in my Firefox cookies SOMEWHERE. I just don't know where!
    I don't really want to delete ALL my cookies -- they do some useful things -- so what I really want is to figure out exactly how the LA Times is determining how many visits I've made to their site and get rid of that cookie. They can't be just tracking my ISP address or I'd still be getting blocked when I use Chrome.
    How can I find out what cookie is causing the problem? Also, is there a way to keep the LA Times from tracking this data in the future? It's not that I want to cheat them of their rightful revenue, it's just that I really don't use their site that often (or I'd pay for it). I assume they have an interest in my viewing their ads or they wouldn't offer any free page views at all.
    An alternative solution would be to somehow tell Google that I don't want it to display any search results it gets that point me to the LA Times so that I don't have to deal with that obnoxious popup when I click to get a news story. I'm perfectly okay with simply not visiting the LA Times for my news but I rarely have the awareness to notice that I'm clicking on an LA Times link before I've gone ahead and clicked on it. I realize this isn't the place to ask that question but if by random chance someone happens to know how to do that instead, that would be great.

    Yeah, that was the first thing I did -- I got rid of the "latimes" and "latimesblog" cookie folders, but it didn't solve the problem at all. This is why I'm thinking it's a hidden or inobvious cookie that the site is somehow using to track my visits. Is there any way to actually SEE when a website is writing a cookie and what cookies it's writing?

  • I want to find a particular word in a file

    Hi,
    I have got the contents of a file in a ArrayList using :
    String name = null;
         ArrayList<String> myArrayStrings = new ArrayList<String>();Then got a word using : myArrayStrings.get(r) This word was generated randomly and in a loop so I dont know what this word is going to be.
    Now I want to search this "myArrayStrings.get(r)" in another file. How to do that?
    Thanks

    Now I want to search this "myArrayStrings.get(r)" in another file. How to do that?Store the returned String. Do the same thing you did to read the first file to read the second file (i.e. read it in line-by-line and store the lines in a list). Then check if that list contains the String you stored from the first list.
    E.g. (using your code):
    String name = myArrayStrings.get(r); // assuming r is initialized somewhere before this
    if ( otherList.contains( name ) ) { // assuming otherList is your second list
        // do something
    }

  • How to find a lost word document

    I was working on a document on Friday 23rd May, saved it and closed it as usual. Today is Sunday 25th and I have tried to access the document. I have gone to recrntly opened documents on Word for Mac. The usual icon has disappeared and in it place was an empty white box. I have clicked on the document and a message displayed saying that word could not locate the document would I like to locate it myself.
    I have taken a print screen of the location of the document. I have searched but cannot find it.
    The document was saved in the usual way so I can think of no reason why this has happened.
    Very grateful for any assistance.

    Have you tried Spotlight ?
    Click the magnifying glass icon top right corner of your screen.
    Type in the name of the document.http://support.apple.com/kb/ht2531
    Mac Basics: Spotlight
    Also, try Recent Items from your Apple  drop down menu.

  • How to find out first words in a sting

    Hi All,
    I have a requirement to find out first two words in a string by using SQL.
    Your help will be more appreciated.
    Thank you,

    Thanks for pointing it out, sy...
    user536769:
    depending on the range of characters that can be present in a word in your system, the RE can be made more exhaustive:
    test@ORA10G>
    test@ORA10G> @ver1
    BANNER
    Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
    test@ORA10G>
    test@ORA10G> with t as (
      2    select 'a man, a plan, a canal - Panama' as x from dual union all
      3    select 'the quick brown fox' from dual union all
      4    select 'Cast Away' from dual union all
      5    select 'Help! (1965) - The Beatles' from dual union all
      6    select 'R2-D2, Anakin Skywalker/Darth Vader, Obi-Wan Kenobi, C-3PO' from dual union all
      7    select 'first       second third' from dual union all
      8    select '"The'||chr(9)||'Bet"'||chr(9)||'by Anton Chekhov' from dual union all
      9    select 'abracadabra' from dual
    10  )
    11  select
    12    x as string,
    13    regexp_replace(x, '([a-zA-Z"0-9!)(._,-]+)\s+([a-zA-Z"0-9!)(._,-]+).*$','\1 \2') as first_two
    14  from t;
    STRING                                                       FIRST_TWO
    a man, a plan, a canal - Panama                              a man,
    the quick brown fox                                          the quick
    Cast Away                                                    Cast Away
    Help! (1965) - The Beatles                                   Help! (1965)
    R2-D2, Anakin Skywalker/Darth Vader, Obi-Wan Kenobi, C-3PO   R2-D2, Anakin
    first       second third                                     first second
    "The    Bet"    by Anton Chekhov                                   "The Bet"
    abracadabra                                                  abracadabra
    8 rows selected.
    test@ORA10G>
    test@ORA10G>
    test@ORA10G>cheers,
    pratz

  • Sql:How to find out Particular column Value in DB?

    Hi,
    I have to findout particular column value inDB ( I don't know table Name ).
    can U tell me query for above.

    I want to find the 'name of that 27 year old male train passenger'. I don't know in which country. can you help me please... :-(..commmooon..

Maybe you are looking for