Search for a particular character in a file

I would like to look for a particular character(@) in a file. The character might be in a word. When if find the character I want to read the actual whole word that contains that character.
What's the best way of going abt this?
Thx,
Kapapra.

Use StringTokenizer, here is example
StringTokenizer tokenizer = new java.util.StringTokenizer(yourString, " ");
while(tokenizer.hasMoreTokens())
   String word = (String) tokenizer.nextToken();
   if ( word.indexOf("@") >=0 )
       // word contains @
  else
        // word does not contain @
}

Similar Messages

  • Scan\Look for a particular character in a file

    I would like to look for a particular character(@) in a file. The character might be in a word. When if find the character I want to read the actual whole word that contains that character.
    What's the best way of going abt this?
    Thx,
    Kapapra.

    Read the file line by line using BufferedReader.
    Tokenize each line on space.
    Loop through the token strings.
    For each token that contains the character that you are looking for (e.g. @) found using indexOf operator of the String class, print or save (or whatever you want to do with that token) that token.
    Continue reading the file line by line till the end of the file.
    Does this make sense? Look the java.io package API for the details on how to read the file and stuff.
    If anyone has more effecient method to do this, please share.

  • How can I search for a particular color in an image?

    Hi,
       I am working on images of colored balls.
    I want to search for the particular color (of the ball) and select them .
    How can I do it?
    Your suggestions will be helpful.
    Thanks
    dsk

    Hi Dsk, 
                   you can apply color threshold and extract the required color in the image. Try color threshold in vision assistant.
                  see  here
    Thanks as kudos only

  • How do i search for a string in a txt file using java??

    How do i search for a string in a txt file using java??
    could you please help thanks
    J

    Regular expressinos work just fine, especially when
    searching for patterns. But they seem to be impying
    it's a specific group of characters they're looking
    for, and indexOf() is much faster than a regex.If he's reading from a file, the I/O time will likely swamp any performance hit that regex introduces. I think contains() (or indexOf() if he's not on 5.0 yet) is preferable to regex just because it's simpler. (And in the case of contains(), the name makes for a very clear, direct mapping between your intent and the code that realizes it.)

  • How to search for a particular word in notes app (ios6)

    Sir,
    I can search for a note but i couldnt search for a particular word in a long note in notes app.
    (ios 6)
    is there a way to do it,or is there any app that has this 'search for word' functionality ?

    thank you for your quick reply sir.
    i am asking for other independent notable apps(not notes app) which has this functionality .

  • 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 particular pattern in a string

    Hi,

    Hi ,
    How to search for a particular pattern in a string?
    I heard about java.util.regex; and used it in my jsp program.
    Program I used:
    <% page import="java.util.regex"%>
    <% boolean b=Pattern.matches("hello world","hello");
    out.println(b);%>
    I run this program using netbeans and am getting the following error message.
    "Cannot find the symbol : class regex"
    "Cannot find the symbol : variable Pattern "
    How to correct the error?

  • When I am searching for any particular song or album from my shared ITUNES folder, the search is conducted  in the apple store and not on the shared library. How to search for the song in the shared library

    I am using IPAD Mini.When I am searching for any particular song or album from my shared ITUNES folder, the search is conducted  in the apple store and not on the shared library. How to search for the song in the shared library

    Search for shared library is impossible, as far as I know.  Searches supported - are local and internet.

  • Code for reading particular  fields from the file placed in application

    hi,
    code for reading particular  fields from the file placed in application server in to the internal table.

    Hi,
    Use the GUI_UPLOAD FM to upload the File into ur Internal Table.
    DATA : FILE_TABLE TYPE FILE_TABLE OCCURS 0,
             fwa TYPE FILE_TABLE,
             FILENAME TYPE STRING,
             RC TYPE I.
    CALL METHOD CL_GUI_FRONTEND_SERVICES=>FILE_OPEN_DIALOG
      EXPORTING
        WINDOW_TITLE            = 'Open File'
       DEFAULT_EXTENSION       =
       DEFAULT_FILENAME        =
       FILE_FILTER             =
       INITIAL_DIRECTORY       =
       MULTISELECTION          =
       WITH_ENCODING           =
      CHANGING
        FILE_TABLE              = FILE_TABLE
        RC                      = RC
       USER_ACTION             =
       FILE_ENCODING           =
      EXCEPTIONS
        FILE_OPEN_DIALOG_FAILED = 1
        CNTL_ERROR              = 2
        ERROR_NO_GUI            = 3
        NOT_SUPPORTED_BY_GUI    = 4
        others                  = 5
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
                WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    READ TABLE FILE_TABLE INDEX 1 into fwa.
    FILENAME = fwa-FILENAME.
        CALL FUNCTION 'GUI_UPLOAD'
             EXPORTING
                  filename                = filename
                  FILETYPE                = 'DAT'
           IMPORTING
                FILELENGTH              =
             TABLES
                  data_tab                = itab
             EXCEPTIONS
                  file_open_error         = 1
                  file_read_error         = 2
                  no_batch                = 3
                  gui_refuse_filetransfer = 4
                  invalid_type            = 5
                  OTHERS                  = 6 .
        IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
             WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
        ENDIF.
    Regards,
    Balakumar.G
    Reward Points if helpful.

  • When I do a search for a particular song in the iTunes store, how can I change the view for the results?

    I have the latest version of iTunes.  Today I did a search for a particular song.  In the past, I used to get a list of the song and the various artists who recorded it, and I could click the little arrow and play a preview of that song before I decided to buy it.  Today the results didn't display that way - instead, I got a page with probably 50 or 100 songs all spread out across the page, and the "writing" was all overlayed so you couldn't quite tell what you're supposed to see!  I want to go back to the "list" view but couldn't find anywhere to change the view preference.  Any idea how?

    Do a malware check with some malware scan programs.<br />
    You need to scan with all programs because each program detects different malware.<br />
    Make sure that you update each program to get the latest version of the database before doing a scan.<br />
    * http://www.malwarebytes.org/mbam.php - Malwarebytes' Anti-Malware
    * http://www.superantispyware.com/ - SuperAntispyware
    * http://www.microsoft.com/windows/products/winfamily/defender/default.mspx - Windows Defender: Home Page
    * http://www.safer-networking.org/en/index.html - Spybot Search & Destroy
    * http://www.lavasoft.com/products/ad_aware_free.php - Ad-Aware Free
    See also "Spyware on Windows": http://kb.mozillazine.org/Popups_not_blocked and [[Searches are redirected to another site]]
    There are other things that need attention:
    Your above posted system details show outdated plugin(s) with known security and stability risks that you should update.
    *Next Generation Java Plug-in 1.6.0_16 for Mozilla browsers
    Update the [[Java]] plugin to the latest version.
    *http://www.oracle.com/technetwork/java/javase/downloads/index.html (Java Platform: Download JRE)

  • Searching for a string in an excel file and return true if found.

    How can I search for a string in an excel file and return true if found, its location and also a value.

    The problem with searching an excel file is that it contains a header. It would be easiest if you just read the file into a LabVIEW array and search the array. This way you can also get the index and the value of the location.

  • Search for a particular user

    I have configured LDAP authentication and mapped few LDAP user groups to BOXI. When an user group is added all the user will also be mapped to BOXI. For the users mapped the distinguished name is added as one of the alias.
    The requirement is to search for a particular user in the BOXI using the distinguished name(DN), hence need to query on the alias name or ID. I tried the query something like but didn't worked.
    SELECT * FROM CI_SYSTEMOBJECTS WHERE SI_KIND='User' AND SI_ALIASES.1.SI_NAME like '%DISTINGUISHED_NAME%'
    IF the DN is like cn=userName,ou=users,ou=group1, dc=myorg, dc=com and the query is written as it works.
    SELECT * FROM CI_SYSTEMOBJECTS WHERE SI_KIND='User' AND SI_ALIASES like '%userName%'
    Could you help in writing a query on the user alias.
    Thanks in advance.

    Here is yours for all posts, sorted chronologically from oldest to newest in descending order and showing 100 entries per page...
    http://forums.sdn.sap.com/search.jspa?userID=3743484&rankBy=1&threadID=&q=&objID=&dateRange=all&numResults=100
    You can play around with the available parameters a bit to tune it further.
    Cheers,
    Julius

  • How to search for the particular ABAP Object

    Hi,
    I am using the SAP 4.6C machine, I need to search for the particular ABAP Object. Plz can anyone help me in this.
    Regards,
    Pralhad P. Teggi

    You'll get a better response if you ask a meaningful question.
    If you want to scan for Business Objects (BOR) use transaction SWO1
    For ABAP classes / objects use a combination of transactions SE24 / SE18 / SE19 and /or SE80
    (SE 18 /  SE 19 are for Badi's)
    Cheers
    Jimbo

  • Total number of records when we do search for a particular item in Istore.

    Hi
    I need the total count of the records when we search for a particular item.
    I wrote a sql query using like condition which is match short and long description but in some cases it is failing.
    Can you guide,how to solve this issue.
    Thanks,
    Sabitha

    Sabitha,
    the mismatch could be due to the Fuzzy search profile option.
    Please check if fuzzy search has been enabled.
    Thanks
    Pradeep
    www.oracleappstips.com

Maybe you are looking for

  • Getting error while saving image to database

    hi, i am getting error when i click commit button when i try to save image the message is as Cannot create an object of type:java.sql.Blob from type:oracle.jbo.domain.BlobDomain with value:ÿØÿàJFIF``ÿáExifMM*2VGFGI2œ�êô‡ijÔ2009:03 please help me soon

  • SRM Smartform - How to write custom logic to get data

    Hi Experts, I am new to SRM 7.0 now. I want to know where the code logic can be written to print the custom smart form? I have already create custom smarts form ZBBP_PO, and implement the BADI  BBP_OUTPUT_CHANGE_SF to pass the custom form name. But i

  • Ipad froze after trying to upgrade to ios 8

    good day, I tried to update my ipad mini to ios 8, it started the process and then froze on a black screen w/the apple logo, any suggestions ? thank you

  • Reagrding OO ALV

    Hi All, I have developed one editable ALV report using methods. After editing the values when i press the save button iam getting the error like ( itab-fieldname not in the ABAP dictionary ). How to over come this problem.

  • Error in Whscode while importing stock

    Hi while importing stock im taking wharehouse code as 1in "ostockTaking" Template but system is giving error [OITW.Whscode],'No matching record found{ODBC-2028} how to solve it? Thanks