How to check a string is contains numberic digits only ??

Can anyone tell me what methods I should use and how to use ??
It is because the string may contains char. or symbol, but I only want the string contains numberic only. (It means the wrong string can be convert into integer)
Thank you in advance !!

Well I guess you could always do like this:
boolean digitsOnly = false;
try {
Integer.parseInt(yourString);
digitsOnly = true;
}catch(Exception e) {
System.out.println("The string isn't a integer value");
if (digitsOnly) {
}

Similar Messages

  • How to check whether a field contains at least one numeric value

    how to check whether a field contains at least one numeric value..

    Hi,
    I hope that this code will works.
    constants:
       c_digit_grp        TYPE char11         VALUE '0123456789',        " Digit group
    * Data Declaration
    data :
      str   type string.
    * if you want check entire string and pass entire string
    if  str CA c_digit_grp.
    * write your logic ---this block will execute atleast one numeric value exists in the string
    Endif.
    Regards
    Bhupal Reddy

  • How can I have 2 versions of Numbers but only 1 app?  Read

    This is the weirdest thing I ever saw. It's driving me crazy and making me look like  fool.
    In an earlier post I mentioned that something happened to my numbers.  The window looked very different from this afternoon when I created 2 new spread-sheets.  I must have sounded crazy to qinn below in my answer.
    Now I clicked the Numbers icon in the dock and it opened to my original Numbers 09 (2.3).  So I tried to open a sheet I created a few hours ago and it says I can't open that file, I need a later version of Numbers. OMG
    Just a though so I opened the finder, went to the applications folder and I only have ONE Numbers.app.  So I clicked on that and low-and-behold the new 3.2.2 opened!!!!!!!
    How can I have 2 versions of numbers but only one app????  I thought I was going crazy.  Now I know something isn't right.
      HELP PLEASE!!!
    Allen

    Hi Allen,
    Look in your Applications folder for an other folder "iWork '09".
    Breathe.
    Know that you are not alone. Wayne made a user tip and it is not just for you.
    Need newer version of Numbers to open file
    quinn

  • How to check particluar string in xml data

    Dear oracle Experts.
    Im using the following oracle database.
    Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bi
    PL/SQL Release 10.2.0.4.0 - Production
    CORE 10.2.0.4.0 Production
    TNS for Linux: Version 10.2.0.4.0 - Production
    NLSRTL Version 10.2.0.4.0 - Production
    I have a following xml data..
    p_msg_in CLOB :=
    <DATA>
    <FLD FNR="ZZ0584" DTE="26SEP12" SRC="DXB" DES="DAC" />
    <AAA LBP="22334455" ETK="1234567/4" ACT="123" />
    <AAA LBP="223344" ETK="2345678/1" />
    <AAA LBP="223344" ETK="123456/1" ACT="345" />
    </DATA>
    then, im fetching header details like this..
    v_msg_xml := xmltype(p_msg_in);
    FOR i IN multicur(v_msg_xml, '/DATA/FLD') LOOP
    v_1:= i.xml.extract('//@FNR').getstringval();
    v_4:= to_date(i.xml.extract('//@DTE').getstringval(),'DDMONYY');
    v_5:= i.xml.extract('//@SRC').getstringval();
    v_6:= i.xml.extract('//@DES').getstringval();
    END LOOP;
    after this, I need to loop all the actual records one by one using this for loop. Here for each iteration , i need to check some string ( example ACT) is there or not. in the above example, records 1,3 have ACT value in it. So here i need to check some thing like this. if instr('<AAA LBP="223344" ETK="123456/1" ACT="345" />','ACT)>0 before I perform the below step.
    How to achieve this.
    I appreciate your help.
    thank you.
    FOR c IN multicur(v_msg_xml, '/DATA/AAA') LOOP
    v_7 := c.xml.extract('//@LBP').getstringval();
    v_8 := c.xml.extract('//@ETK').getstringval();

    SQL> DECLARE
      2 
      3    p_msg_in  clob := '<DATA>
      4  <FLD FNR="ZZ0584" DTE="26SEP12" SRC="DXB" DES="DAC" />
      5  <AAA LBP="22334455" ETK="1234567/4" ACT="123" />
      6  <AAA LBP="223344" ETK="2345678/1" />
      7  <AAA LBP="223344" ETK="123456/1" ACT="345" />
      8  </DATA>';
      9 
    10    v_msg_xml xmltype;
    11 
    12    v_1       varchar2(30);
    13    v_4       date;
    14    v_5       varchar2(30);
    15    v_6       varchar2(30);
    16    v_7       varchar2(30);
    17    v_8       varchar2(30);
    18 
    19  BEGIN
    20 
    21    v_msg_xml := xmltype(p_msg_in);
    22 
    23    select fnr, to_date(dte, 'DDMONRR'), src, des
    24    into v_1, v_4, v_5, v_6
    25    from xmltable('/DATA/FLD'
    26           passing v_msg_xml
    27           columns fnr  varchar2(30) path '@FNR'
    28                 , dte  varchar2(30) path '@DTE'
    29                 , src  varchar2(30) path '@SRC'
    30                 , des  varchar2(30) path '@DES'
    31         ) ;
    32 
    33     dbms_output.put_line('V1 = '||v_1);
    34     dbms_output.put_line('V4 = '||v_4);
    35     dbms_output.put_line('V5 = '||v_5);
    36     dbms_output.put_line('V6 = '||v_6);
    37 
    38     for r in (
    39       select lbp, etk
    40       from xmltable('/DATA/AAA[@ACT]'
    41              passing v_msg_xml
    42              columns lbp  varchar2(30) path '@LBP'
    43                    , etk  varchar2(30) path '@ETK'
    44            )
    45     )
    46     loop
    47       dbms_output.put_line('LBP = '||r.lbp||' ETK = '||r.etk);
    48     end loop;
    49 
    50  END;
    51  /
    V1 = ZZ0584
    V4 = 26/09/12
    V5 = DXB
    V6 = DAC
    LBP = 22334455 ETK = 1234567/4
    LBP = 223344 ETK = 123456/1
    PL/SQL procedure successfully completed

  • How to check empty string and null? Assign same value to multiple variables

    Hi,
    1.
    How do I check for empty string and null?
    in_value IN VARCHAR2
    2. Also how do I assign same value to multiple variables?
    var_one NUMBER := 0;
    var_two NUMBER := 0;
    var_one := var_two := 0; --- Gives an error
    Thanks

    MichaelS wrote:
    Not always: Beware of CHAR's:
    Bug 727361: ZERO-LENGTH STRING DOES NOT RETURN NULL WHEN USED WITH CHAR DATA TYPE IN PL/SQL:
    SQL> declare
      2    l_str1   char (10) := '';
      3    l_str2   char (10) := null;
      4  begin
      5  
      6    if l_str1 is null
      7    then
      8      dbms_output.put_line ('oh STR1 is null');
      9    elsif l_str1 is not null
    10    then
    11      dbms_output.put_line ('oh STR1 is NOT null');
    12    end if;
    13  
    14    if l_str2 is null
    15    then
    16      dbms_output.put_line ('oh STR2 is null');
    17    elsif l_str2 is not null
    18    then
    19      dbms_output.put_line ('oh STR2 is NOT null');
    20    end if;
    21  end;
    22  /
    oh STR1 is NOT null
    oh STR2 is null
    PL/SQL procedure successfully completed.
    SQL> alter session set events '10932 trace name context forever, level 16384';
    Session altered.
    SQL> declare
      2    l_str1   char (10) := '';
      3    l_str2   char (10) := null;
      4  begin
      5  
      6    if l_str1 is null
      7    then
      8      dbms_output.put_line ('oh STR1 is null');
      9    elsif l_str1 is not null
    10    then
    11      dbms_output.put_line ('oh STR1 is NOT null');
    12    end if;
    13  
    14    if l_str2 is null
    15    then
    16      dbms_output.put_line ('oh STR2 is null');
    17    elsif l_str2 is not null
    18    then
    19      dbms_output.put_line ('oh STR2 is NOT null');
    20    end if;
    21  end;
    22  /
    oh STR1 is null
    oh STR2 is null
    PL/SQL procedure successfully completed.
    SQL> SY.

  • How to convert a String which contains integers to an integer

    Hi, I'm doing a simple user-interaction program. For example I ask how many people are in a group. and they give me an answer with a integer number. But how can I convert the System.in to an real integer value, i.e. How can a String value which contain an integer convert to an integer value?
    InputStreamReader inputStreamR = new                               InputStreamReader(System.in);
    BufferedReader bufR = new BufferedReader(inputStreamR);
    String ans = bufR.readLine();
    and then what? (I want the answer is an integer);
    Thanks

    String ans = bufR.readLine();
    try {
      int ansAsInt = Integer.parseInt(ans);
    } catch (NumberFormatException nfe) {
      // What happens if the String was not an integer
    }

  • How to check for Auto Allocated Serial Numbers

    Hi
    I have chosen ALLOCATE SERIAL NUMBERS = YES in Organization Parameters Form.
    I have set the Item SERIAL GENERATION = AT SALES ORDER ISSUE at Item Level.
    Done with the creation of Sales Orders
    Done with Releasing a SO(Auto Allocate = NO and Auto PICK CONFIRM = NO)
    Done with Transacting a Move Order.
    Now moved to SHIPPING > TRANSACTIONS Form
    In Lines/LPNs Tab, Entered Shipped Qty and then I forgot to allocate/assign Serial numbers from TOOLS --> Serial Numbers and created Deliveries and Trip Stops.
    Now the Delivery status is CLOSED and Line status is SO Form in SHIPPED.
    As I forgot to allocate sno's,system would have allocated serial numbers because ALLOCATE SERIAL NUMBERS = YES in Organization Parameters Form.
    Now my Question is,
    How to find the serial Numbers that were allocated by the system?
    Thanks
    Veda

    Hello,
    What is the question?
    Now you have line closed but delivery is still open?
    Run this request OM > Shipping > Interfaces > Inventory Interface–SRS set debug to 1.
    In requests you have Inventory Interface–SRS, Shipping.... SRS and another with SRS. I do not remember correct name now but you have to pick last one:) and set debug to 1. I will give proper name tomorrow.
    Look into results and look for errors.
    Regards,
    Luko
    Edited by: Luko on 2010-04-29 20:48

  • How to check if a list contains items from another list

    Hi all,
    I am trying to check whether a text list contains items form
    another list and then do something. I tried:
    tlist contains text phrases (e.g., test1,test2,test3)
    phrases = ["test1","test2"]
    n = phrases.count()
    tList.getPos(phrases.item[n])
    alert("should not be inluded in the list")
    But it is not working any ideas why?

    myPhrase is the loop index, but instead of a numerical index
    (like n in your sample), myPhrase is set equal to each item in the
    phrases list, first item to last. So, on the first iteration
    myPhrase = “test1”, on the second iteration myPhrase =
    “test2”. The loop automatically exits when the end of
    the list is reached. The Director help docs have more information
    on this syntax under “repeat”
    BTW: if you're more comfortable using a numerical index, the
    syntax for getting at the n-th item in a list is list[n], or in
    your sample phrases[n]

  • How to check a String in PL/SQL

    Hello Everyone,
    First Question :
    In my PL/SQL code say if I get something from table like :
    Associate A - L 1
    Associate B - L 1
    Associate C - L 2
    System Stable
    I want to find out if the value is Associate and then do this....How can I partially compare the string and if it is System Stable then do something else....
    So basically how can I say (Associate A- L1 partially matches Associate) then do this...
    Secondly, I want to strip whatever it is after Associate A or Associate B....how can I do that...
    So input string Associate A - L1 and output is Associate A...
    Thanks,
    Harsimrat

    Your need is kind of different, but ok
    1) if v_coltext like 'Associate%' then
    -- do something
    2) substr(v_coltext, 1, length('Associate')+2)
    That should do it I guess.
    Lee

  • How to check a PDF document contain password security?

    Are there anyway to check it for OLE automation?
    I want to test whether the document is editable.
    Dont't tell me that I need to try edit or insert blank page to test it.
    I need a quick way to test it without modify the content.

    No, the OLE/COM APIs don't support this.

  • How to convert Character string to individual Numbers for IN clause?

    Hi,
    I'm using the following query but its throwing the error shown below. Please help.
    declare
    ln_UID VARCHAR2(200) := '21,24';
    ln_NUM NUMBER;
    begin
    dbms_output.put_line('ln_UID ' || ln_UID);
       SELECT COUNT(USAGE_RESOURCE_PERMISSION_ID)
          INTO ln_NUM
        FROM  S_USAGE_RESOURCE_PERMISSIONS SURP,
          S_USAGE_PROFILE SUP,
          S_RESOURCE_PERMISSIONS SRP,
          S_RESOURCE SR,
          S_RESOURCE_GROUP SRG
        WHERE SUP.USAGE_PROFILE_ID = SURP.USAGE_PROFILE_ID
          AND SURP.RESOURCE_PERMISSION_ID = SRP.RESOURCE_PERMISSION_ID
          AND SUP.USAGE_PROFILE_ID IN (ln_UID)
          AND SRP.RESOURCE_PERMISSION_VAL <> 3 --view
          AND SRP.RESOURCE_ID = SR.RESOURCE_ID
          AND SR.RESOURCE_GROUP_ID = SRG.RESOURCE_GROUP_ID
          AND SRG.PRODUCT_ID = (SELECT PRODUCT_ID FROM S_PRODUCTS WHERE PRODUCT_NAME='RBPS');
    dbms_output.put_line('ln_NUM ' || ln_NUM);
    end;
    error-
    Error starting at line 1 in command:
    declare
    ln_UID VARCHAR2(200) := '(21,24)';
    ln_NUM NUMBER;
    begin
    dbms_output.put_line('ln_UID ' || ln_UID);
       SELECT COUNT(USAGE_RESOURCE_PERMISSION_ID)
          INTO ln_NUM
        FROM  S_USAGE_RESOURCE_PERMISSIONS SURP,
          S_USAGE_PROFILE SUP,
          S_RESOURCE_PERMISSIONS SRP,
          S_RESOURCE SR,
          S_RESOURCE_GROUP SRG
        WHERE SUP.USAGE_PROFILE_ID = SURP.USAGE_PROFILE_ID
          AND SURP.RESOURCE_PERMISSION_ID = SRP.RESOURCE_PERMISSION_ID
          AND SUP.USAGE_PROFILE_ID IN ln_UID
          AND SRP.RESOURCE_PERMISSION_VAL <> 3 --view
          AND SRP.RESOURCE_ID = SR.RESOURCE_ID
          AND SR.RESOURCE_GROUP_ID = SRG.RESOURCE_GROUP_ID
          AND SRG.PRODUCT_ID = (SELECT PRODUCT_ID FROM S_PRODUCTS WHERE PRODUCT_NAME='RBPS');
    dbms_output.put_line('ln_NUM ' || ln_NUM);
    end;
    Error report:
    ORA-01722: invalid number
    ORA-06512: at line 6
    01722. 00000 -  "invalid number"
    *Cause:   
    *Action:Thanks.

    u cant use ln_UID like that in IN. when you do that it checks for SUP.USAGE_PROFILE_ID = '21,24'
    so you can try some thing like this.
    Note: Code not tested as i dont have the required data structure.
      WITH T AS
      (select to_number(substr(','||ln_UID||',',val,val1-val)) col
        from (select instr(','||ln_UID||',',',',1,level)+1 val, instr(','||ln_UID||',',',',1,level+1) val1
                  from dual
            connect by level <= length(replace(translate(ln_UID,'0123456789',' '),' ',''))+1))
      SELECT COUNT(USAGE_RESOURCE_PERMISSION_ID)
          INTO ln_NUM
        FROM  S_USAGE_RESOURCE_PERMISSIONS SURP,
          S_USAGE_PROFILE SUP,
          S_RESOURCE_PERMISSIONS SRP,
          S_RESOURCE SR,
          S_RESOURCE_GROUP SRG
        WHERE SUP.USAGE_PROFILE_ID = SURP.USAGE_PROFILE_ID
          AND SURP.RESOURCE_PERMISSION_ID = SRP.RESOURCE_PERMISSION_ID
          AND SUP.USAGE_PROFILE_ID IN (SELECT COL FROM T)
          AND SRP.RESOURCE_PERMISSION_VAL <> 3 --view
          AND SRP.RESOURCE_ID = SR.RESOURCE_ID
          AND SR.RESOURCE_GROUP_ID = SRG.RESOURCE_GROUP_ID
          AND SRG.PRODUCT_ID = (SELECT PRODUCT_ID FROM S_PRODUCTS WHERE PRODUCT_NAME='RBPS');Thanks,
    Karthick.

  • To check that string contains space

    Hi...
    I have one char string, If that string contains any space then I want to display a message.
    how to check that string contains 'space'.
    Regards,
    Rohit

    Hi, you can do a small work.
    you can split the char string into substrings at spaces.
    if there is space then it will be splitted and then you can check the sy-subrc.
    if sy-subrc = 0,
    then the char string had some space in it.
    regards
    jayati

  • 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

  • How to check collection.contains(..) inside a tag ?

    Hi,
    I'm using both struts and jtsl tags in my jsp. JSP session has a Collection named "responses" that contains string objects.
        <c:forEach items="${page.questions}" var="question" varStatus="i">
              <tr>
                   <th align="left"><c:out value="${question.questionId}. ${question.text}"></c:out></th>
              </tr>
            <c:forEach items="${question.answers}" var="answer" varStatus="j">
              <tr>
               <td>     
                         <c:set var="aKey" value="${question.OID}_${answer.OID}"></c:set>
                      <c:if test="${question.type == 1}">
                         <c:out value="${answer.answerId}"/>
                         <input id="<c:out value="KEY_${question.OID}"/>" name="<c:out value="KEY_${question.OID}"/>" type="radio" <c:if test="??? session.getAttribute("responses").contains(${question.OID}_${answer.OID}) ???" ><c:out value="selected=true"/></c:if> value="<c:out value="${question.OID}_${answer.OID}"/>"><c:out value="${answer.text}"/>                 
                      </c:if>
                      <c:if test="${question.type == 2}">
                         <c:out value="${answer.answerId}"/>
                         <input id="<c:out value="KEY_${answer.OID}"/>" name="<c:out value="KEY_${answer.OID}"/>" type="checkbox"  value="<c:out value="${question.OID}_${answer.OID}"/>"><c:out value="${answer.text}"/>                 
                      </c:if>                  
                 </td>
            </tr>                  
            </c:forEach>
         </c:forEach>Please see the following line in the code
    <c:if test="??? session.getAttribute("responses").contains(${question.OID}_${answer.OID}) ???" ><c:out value="selected=true"/></c:if>I need to check if a collection contains a string value or not. If contains I'm selecting the radio button otherwise not.
    Any help will be appreciated!
    Thanks

    There is no way to tell if a collection contains a value.
    If you changed your datastructure to a Map, you can check for the existence of a key in a map, but thats about it.
    Alternatively write a static function for this operation, and import it into the jsp as an EL function.
    Cheers,
    evnafets

  • How to insert a string containing a single quote to the msql database? help

    how can i insert a string which contains a single quote in to database... anyone help
    Message was edited by:
    sijo_james

    Absolutely, Positively use a PreparedStatement. Do not use sqlEscape() function unless you have some overriding need (and I don't know what that could possibly be).
    There are 1000's of posts on the positive aspects of using a PreparedStatement rather than using a Statement. The two primary positive attributes of using a PreparedStatement are automatic escaping of Strings and a stronger security model for your application.

Maybe you are looking for

  • Zen Touch versus Zen Vision

    An ex-Ipod sinner here, coming back to the fold after having dumped his Muvo TX for the devil's instrument...! Hate the way Ipod ties you to Itunes and takes forever to update new albums, also takes massi've amounts of Windows resources, and have a l

  • Select in stored procedures 11g

    I come from MS Sql Server, so select statements in Oracle are confusing, I have only 3 days experience with Oracle 11g I have managed to use SELECT INTO in my SP Can anyone provide an example of select using a for loop_+  AND  an example of select us

  • Lightroom 3.2 runs slow

    Can I revert back to lightroom 3.0?  I installed the upgrade earlier this week, and am having stalling problems.  I have 8G of memory and a 1T drive, so don't think it's my system.  LR3.0 ran fine, but now 3.2 is really lagging. Need some help. Marga

  • Deploying Web services on Oracle Application Server

    Hi, I am not sure whether this is the forum where I should post this question. I am trying to deploy a webservice on Oracle iAS version1.0.0. But when I navigate to Oracle CRM Administrator(responsibility)-->Integration-->services I get a message tel

  • Audio not playing in clips in exported movie

    Hi, I have a 4 minute movie made up of a load of clips, and two iTunes mp3s. All the clips are muted and the music plays over them - except for a short section in between the two songs, where the clips are unmuted. The movie plays as it should in the