To check the string for a particular character

i want to check the string contains ',' (comma) or not. can anyone help me?

i want to check the string contains ',' (comma) or
not. can anyone help me?you can use 'indexOf' method at string object
String s1 = "test,tet1";
boolean bfind = s1.indexOf(',') > -1 or
boolean bfind = s1.indexOf(",") > -1

Similar Messages

  • Match the string for a particular format

    i want to chek the string for a particular format..
    lets say for ex ,
    i have to check the string for 6A1N format where A - Alphabets and N - Numbers.
    that means my string exactly contains 6 alphabets from a to z and one number from 0 to 9
    like this i want to check for two more fromats..they are..
    2A7N1A or
    9N1A

    koneru9999 wrote:
    will the pattern is helpful in my case?
    and i don't have any idea doesn't mean finsh reading all the API right?You need to study http://www.regular-expressions.info/ and then http://java.sun.com/docs/books/tutorial/essential/regex/ .

  • Check the stock for a particular material belonging to a material group.

    Hi,
    Is it possible to check the stock for a particular material belonging to a material group.
    Your help will be appreciated.
    Regards,
    kavita.

    Hi Kavita,
    go to transaction MB52 , in the selection screen enter the material and the material group  that you want the results for, and execute. You will get desired results.
    Regards
    Mangesh
    Reward points if it helps
    Message was edited by:
            Mangesh More

  • Check a String for a particular text

    Hi, I have a String variable.
    How do I check if this String has Something 'like' Apple 1?
    Eg:
    String name=null;
    Now the value in name can be apple 1 or apple 99 or apple 33. SO I need to put an IF statement where i want to say continue IF name is like "Appl 1

    String.find(Pattern)Dry. I think that's matcher.find(Pattern)

  • Need reg_exp for checking the string contains only alphanumeric or not

    Dear All,
    I need to check the given string in if condtion contains only the alphanumeric or not pls help me..
    like
    if reg_exp then
    end if;
    thanks,
    Oracle

    Hi,
    REGEXP_LIKE ( str
                , '[^[:alnum:]]'
                )returns TRUE if the string str contains any character other than an alphanumeric.
    You can use this wherever conditions are allowed, such as a WHERE clause or a CASE expression. For example:
    SELECT     str
    .     CASE
             WHEN  REGEXP_LIKE ( str
                         , '[^[:alnum:]]'
             THEN  'Contains speace, punctuation or special symbol'
             ELSE  'Okay'
         END               AS is_alnum
    FROM     table_x
    I hope this answers your question.
    If not, post a little sample data (CREATE TABLE and INSERT statements, relevant columns only), and the results you want from that data.
    Explain, using specific examples, how you get those results from that data.
    Always say what version of Oracle you're using.
    Edited by: Frank Kulash on Dec 30, 2011 4:37 AM

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

  • 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 @
    }

  • Checking the space for /archlog mount point script

    I have the below shell script which is checking /archlog mount point space on cappire(solaris 10) server. When the space usage is above 80% it should e-mail. When i tested this script it is working as expected.
    #!/usr/bin/ksh
    export MAIL_LIST="[email protected]"
    export ARCH_STATUS=`df -k /archlog | awk '{ print $5 }' | grep -v Use%`
    echo $ARCH_STATUS
    if [[ $ARCH_STATUS > 80% ]]
    then echo "archive destination is $ARCH_STATUS full please contact DBA"
    echo "archive destination /archlog is $ARCH_STATUS full on Cappire." | mailx -s "archive destination on cappire is $ARCH_STATUS full" $MAIL_LIST
    else
    exit 1
    fi
    exit
    When i scheduled a cron job it is giving different result. Right now /archlog is 6%, it should exit without e-mailing anything. But, i am getting the below e-mail from cappire server which is strange.
    subject:archive destination on cappire is capacity
    below is the e-mail content.
    6% full
    Content-Length: 62
    archive destination /archlog is capacity 6% full on Cappire.
    Please help me in resolving this issue - why i am getting the above e-mail, i should not get any e-mail with the logic.
    Is there any issue with the cron. Please let me know.

    user01 wrote:
    I have the below shell script which is checking /archlog mount point space on cappire(solaris 10) server. When the space usage is above 80% it should e-mail. When i tested this script it is working as expected.
    #!/usr/bin/ksh
    export MAIL_LIST="[email protected]"
    export ARCH_STATUS=`df -k /archlog | awk '{ print $5 }' | grep -v Use%`
    echo $ARCH_STATUS
    if [[ $ARCH_STATUS > 80% ]]
    then echo "archive destination is $ARCH_STATUS full please contact DBA"
    echo "archive destination /archlog is $ARCH_STATUS full on Cappire." | mailx -s "archive destination on cappire is $ARCH_STATUS full" $MAIL_LIST
    else
    exit 1
    fi
    exit
    When i scheduled a cron job it is giving different result. Right now /archlog is 6%, it should exit without e-mailing anything. But, i am getting the below e-mail from cappire server which is strange.
    subject:archive destination on cappire is capacity
    below is the e-mail content.
    6% full
    Content-Length: 62
    archive destination /archlog is capacity 6% full on Cappire.
    Please help me in resolving this issue - why i am getting the above e-mail, i should not get any e-mail with the logic.
    Is there any issue with the cron. Please let me know.Not a problem with cron, but possibly an issue with the fact that you are doing a string comparison on something that you are thinking of as a number.
    Also, when I'm piping a bunch of stuff together and get unexpected results, I find it useful to break it down at a command line to confirm that each step is returning what I expect.
    df -k /archlog
    df -k /archlog | awk '{ print $5 }'
    df -k /archlog | awk '{ print $5 }' | grep -v Use%
    A common mistake is to forget that jobs submitted from cron don't source the owning user's .profile. You need to make sure the script takes care of setting its environment, but that doesn't look to be the issue for this particular problem.

  • Check the Stock of a particular material is available in SAP R/3 from Java

    Hi all,
    We have both SAPR/3 and Java Based Systems and going to integrate with XI.
    For Java user is it possible to check the Stock of a particular material is available in SAP R/3 system or not.
    For this requirement can we create any scenario and get the stock available info from SAPR3?
    If so then which type of adapters we have to use in this case.
    The Java user don't want to store any data here and there but just view the stock is available or not just from his end only.
    bye
    regards
    konala

    You can use synchronous Java Proxy-XI-RFC.
    Code the RFC to get the stock of R/3 material and route the response back to proxy.

  • Please Help!! How to get the width of the String for print out?

    Hi there,
    I need to do some printing in my application. I just want to know how can I get the width of the string when it is printed on the paper.
    I have tried to use the following code to get the width
    Rectangle2D rec = font.getStringBounds(str, new FontRenderContext(null, true, true));
    double width = rec.getWidth();
    however, the width I got from that function is not correct (the returned width is longer than the printed one)
    Does anyone know how to solve this problem?
    Thank you and Happy New Year !

    hi,
    The getFontMetrics(Font) is also defined in the Component class and therefore you can retrieve it even if you dont override the paint method.
    try the following (provided ur code extends some class that extends Component indirectly)
    FontMetrics f = this.getFontMetrics(this.getFont());
    int width = f.stringWidth(str); //str is the String for which u need to check the width.
    hope this was useful
    happy holidayz

  • What checks the String pool

    Hi there.
    With regard to the string pool,
    my book states that whenever the compiler
    encounters a string literal that it will check the pool to see if
    there is a matching string...
    This doesn't seem right to me.
    I would have imagined that the JVM would perform this operation at runtime.
    Maybe I'm wrong, but I googled it and I came across some sites that indicate that
    the JVM checks the string pool.
    Im just wondering which is it, the JVM or the compiler.
    Thanks & regards.

    jverd wrote:
    Both.
    String s1 = "abc";
    String s2 = "abc";Compiler sees the first line, looks for "abc" in the class' constant pool, doesn't find it, adds it, places reference to its position for the assignment to s1.
    Compiler sees the second line, looks for "abc", finds it, places reference to its position for the assignment to s2.
    At runtime, when class is loaded, VM loads class' String constant pool. When time comes to execute the above lines, the bytecode tells it which constant pool entry to reference.Great answer (No, I'm not sarcastic)

  • How the files are decreasing from RBS storage after some time i delete docs from document library, where shld I check the settings for this?

    HI
    I created a web application and configured  rbs storage ,
    I uploaded documents (for ex: 18 number)
     after uploaded  documents ,  and observed the RBS storage folder, number of files are increasing (39 number) , its working fine
    and also  I run the querys to check the rows increasing or not , (when I upload new doc rows are increased its fine also)
    select count(*) from alldocs
    Select count(*) from AllDocstreams
    but when I delete some docs from document library ,
    1)the doc itself deleted from document library
    2)when I check the rbs storage  there is no number of files are decreased(its still 39 files ), its same as  before doc deleted from doc library
    after some time I found the number of files are decreasing from RBS storage folder in sql server,
    here I want to know the how the files are decreasing from RBS storage  after some time, where  shld I check the settings for this? and how I control on it
    here how I know the settings for cleaning up orphan BLBOS how  these deleted BLOB
    adil

    1. WHen you delete the file from Sharepoint, it is still present in Recycle bin. This is a default setting in sharepoint for 30 days. Once files are deleted fro Recycle bin, it can also be delete from RBS
    2. There is a RBS cleanup job which deletes files from RBS. for more info check 
    http://mehuljamod.blogspot.in/2012/09/remote-blob-storage-maintainer-rbs.html

  • IPod shuffle 2nd Gen is not recognized on PC, but other shuffles are. Software is updated. Is this the end of the road for this particular shuffle?

    iPod shuffle 2nd Gen is not recognized on PC, but other shuffles are. Software is updated. Is this the end of the road for this particular shuffle?

    Hi envisionquest,
    I'm sorry to hear you are having issues with your iPod. If your 2nd Gen iPod shuffle isn't being recognized by iTunes (but other are), you may find the troubleshooting steps outlined in the following Troubleshooting Assistant helpful:
    Apple - Support - iPod - iPod shuffle (2nd generation) Troubleshooting
    Regards,
    - Brenden

  • How to find out all the OKCODEs for a particular screen?

    I am working on t-code CL20N and trying to record with t-code SHDB, in the second screen when I press enter it is coming out, but when I run CL20N without SHDB it is going through all the screens perfectly, SHDB is not working for CL20N.
    Is there any other way to find out all the OKCODEs for a particular screen/s?

    Hi,
    First look for any push button or menu item which can take you to the second screen instead of hitting enter directly in tcode CL20N . If any such button exist in the TCode, u can use the same button in SHDB also for moving to the  second screen.
    Thanks,
    Rajinikanth G

  • We have an issue when we send a film to the media encoder it crashes about half of the time for no particular reason. Anyone else got that too with Premiere Pro CC and the new Media encoder? Thanks! bedrijfsfilm Companyfilms

    We have an issue when we send a film to the media encoder it crashes about half of the time for no particular reason. Anyone else got that too with Premiere Pro CC and the new Media encoder?

    We have an issue when we send a film to the media encoder it crashes about half of the time for no particular reason
    Anyone else got that too with Premiere Pro CC and the new Media encoder?
    Lack of detailed info makes your question impossible for anyone to answer you!
    eg. ...."Doctor it hurts...anyone else got something that hurts?" 

Maybe you are looking for