How to check wether a string is a number

hi,
I have a string variable like this.
I want to check wether that variable contains a number or not.Pls tell wether there is a java command to check it.
Thanks,
chamal.

try
int x = Integer.parseInt(mystring);
catch(NumberFormatExcpetion nfe)
// not a valid integer
}You need to declare x outside the try block, otherwise you won't be able to access it outside.

Similar Messages

  • How to check  wether local system has blocked by firewall  from program.

    i am a user in my LAN area. i don't have admin rights. in our LAN few system has blocked by firewall others not blocked .
    how can i check wether local host is blocked or not by firewall from java network program ?.

    You can execute some kind of firewall util (if any) and parse output to receive configuration and check is address blocked or no. But if you have no admin rights - it will not help you.
    Actually there is no clear way to detect was packet blocked by FW or just lost somethere.

  • How to check wether we are using Compressed backup option or not in 11gR1?

    Actually I'm trying save some space in FRA? Any Ideas will be really welcome.
    One option I can think of is Compressed backup sets
    I don't see anyhting like 'Compress' in my scripts below....Also in 'Backup Settings' under 'Availability' Tab in Grid
    I see 'Backup Set' selected and not 'Compressed Backup set'.
    Is there anywhere else I can check wether I'm taking compressed backups or not?
    Thanks in Advance
    run {
    RECOVER COPY OF DATABASE WITH TAG "ngprod_incr_backup";
    allocate channel 'dev_0' type 'sbt_tape' parms 'SBT_LIBRARY=/ora00/app/oracle/product/11/db1/lib/libobk.so';
    send 'NSR_ENV=(NSR_SERVER=corpntw01.amhc.amhealthways.net, NSR_CLIENT=NGPROD.amhc.amhealthways.net, NSR_DATA_VOLUME_POOL=UNIX Daily)';
    allocate channel 'dev_1' type 'sbt_tape' parms 'SBT_LIBRARY=/ora00/app/oracle/product/11/db1/lib/libobk.so';
    send 'NSR_ENV=(NSR_SERVER=corpntw01.amhc.amhealthways.net, NSR_CLIENT=NGPROD.amhc.amhealthways.net, NSR_DATA_VOLUME_POOL=UNIX Daily)';
    backup recovery area;
    release channel dev_0;
    release channel dev_1;
    BACKUP INCREMENTAL LEVEL 0 DATABASE TAG "ngprod_incr_backup" ;
    run {
    RECOVER COPY OF DATABASE WITH TAG "ngprod_incr_backup";
    BACKUP INCREMENTAL LEVEL 1 FOR RECOVER OF COPY WITH TAG "ngprod_incr_backup" DATABASE;
    run {
    allocate channel 'dev_0' type 'sbt_tape'
    send 'NSR_ENV=(NSR_SERVER=corpntw01.amhc.amhealthways.net, NSR_CLIENT=NGPROD.amhc.amhealthways.net, NSR_DATA_VOLUME_POOL=UNIX Daily)';
    allocate channel 'dev_1' type 'sbt_tape'
    send 'NSR_ENV=(NSR_SERVER=corpntw01.amhc.amhealthways.net, NSR_CLIENT=NGPROD.amhc.amhealthways.net, NSR_DATA_VOLUME_POOL=UNIX Daily)';
    allocate channel 'dev_2' type 'sbt_tape'
    send 'NSR_ENV=(NSR_SERVER=corpntw01.amhc.amhealthways.net, NSR_CLIENT=NGPROD.amhc.amhealthways.net, NSR_DATA_VOLUME_POOL=UNIX Daily)';
    allocate channel 'dev_3' type 'sbt_tape'
    send 'NSR_ENV=(NSR_SERVER=corpntw01.amhc.amhealthways.net, NSR_CLIENT=NGPROD.amhc.amhealthways.net, NSR_DATA_VOLUME_POOL=UNIX Daily)';
    backup filesperset 1 tag='NGPROD' format 'ARCH<NGPROD_%s:%t:%p>' archivelog all not backed up 2 times;
    delete noprompt archivelog all backed up 2 times to device type sbt;
    release channel dev_0;
    release channel dev_1;
    release channel dev_2;
    release channel dev_3;
    }

    hi,
    also you may define default behaviour of backing up:
    RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO COMPRESSED BACKUPSET;
    Turn on this great feature:
    SQL> alter database enable block change tracking using file '/u01/oradata/ora1/change_tracking.f';
    and use incremental backups.

  • How to check apple care warranty with Serial Number without registering

    How to check the warranty of the apple macbook pro (mid 2009 release) without actually registering the product.
    I have the serial number of the machine.
    I looked into this link ,it seems that it requires you to register the product .
    Earlier that was not the case. You could just check the warranty by entering the serial number and location .
    Link : https://selfsolve.apple.com/GetWarranty.do

    If the product was never registered, you won't be able to check warranty, because as far as Apple is concerned, it's still new and has not been sold yet.
    Dave M.
    MacOSG Founder/Ambassador  An Apple User Group  iTunes: MacOSG Podcast
    Macsimum News Associate Editor  Creator of 'Mac611 - Mobile Mac Support'

  • How to check a particular string in address

    hi,
    I need to check if my address has "freemans" or "foodstuffs or 'db.co.nz, then give a defautl email address. hence i coded like this
    zstmp_addr type ZCHAR60.
    IF ( ts_filerefs-zsmtp_addr CA 'foodstuffs' ) AND
           ( ts_filerefs-zsmtp_addr CA 'freemans' ) AND
           ( ts_filerefs-zsmtp_addr CA 'fremans' )  AND
           ( ts_filerefs-zsmtp_addr CA 'db.co.nz' ) .
        ts_filerefs-zsmtp_addr = 'mail123  ed.com'
    endif.
    This code works fine say if zsmtp_addr = Ben.shield  itcom , comes out of IF condition.
    But if I give zstmp_addr = jayasree.muthaiyan  it.com, goes in to IF condition ---> Error....
    why it goes inside this IF condition...is there any better coding for this ///
    thanks
    kinldy help

    Hi,
    And operator will not work in your case. And instead of CA use 'CS' operator. Refer below code.
    IF ( ts_filerefs-zsmtp_addr Cs 'foodstuffs' ) OR
    ( ts_filerefs-zsmtp_addr CS 'freemans' ) OR
    ( ts_filerefs-zsmtp_addr CS 'fremans' ) OR
    ( ts_filerefs-zsmtp_addr CS 'db.co.nz' ) .
    ts_filerefs-zsmtp_addr = 'mail123 ed.com'
    endif.
    Thanks,
    Archana

  • How to check length of string attribute(from viewobject) on jspx ?

    Hi,
    JDEV : 11.1.1.4
    I am using carousel component inside that i am using Descrip attribute to show the content on carousel item,
    Now i want to display a more link , whenever the length of Descrip is greater than 150 characters.
    Currently from backing bean i am setting the chklength property based on length to true or false but the problem is i need to set a partial target
    and because of that my carousel component i getting refreshed every time.. is there any way to check the length in jspx page itself inside the vissible property
    this is my code
    <af:outputText value="#{item.bindings.Descrip.inputValue}"
                                                             id="ot49"/>
                                               <af:commandImageLink text="more.." id="moreid" shortDesc="click to see more.."
                                                                     visible="#{pageFlowScope.chklength}">
                                                <af:showPopupBehavior popupId="::p1"/>
                                                </af:commandImageLink>              thanks
    Gopinath

    i have added taglib like this,
    xmlns:fn="http://java.sun.com/jsp/jstl/functions"
    but its showing error on below expression
    visible="${fn:length(item.bindings.Descrip.inputValue) > 150}"
    error : BooleanSimnpleTypeConvertor:"${fn:length(item.bindings.Descrip.inputValue) > 150}" cannot be converted to this type

  • HT1349 Is the Apple Magsafe 2 Power Adapter covered under Apples one year warranty?  I cant figure out how to check the date.  The serial number is to long to enter.

    I need help finding out warranty information on the Apple Magsafe 2 Power Adapter.  When I enter the serial number, it is too long for the box.  Any help would be appreciated.  Thanks.

    I got this from my father.  It looks like it is an aftermarket package and not something that came with the original Mac. I will try to attach a picture of the item box and the barcode label.  The actual part number is MD506LL/A .

  • Excute, me could anyone tell me how to know wether iphone 4s is original or fake?

    Excute me, everyone could you tell me how to check wether the iphone 4s is original or fake..?

    What makes you think it's a fake, where did you purchase it from? If you have access to the iPhone, check the serial number using both these links http://www.chipmunk.nl/klantenservice/applemodel.html / https://selfsolve.apple.com/agreementWarrantyDynamic.do

  • 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 check whether a char string is in uppercase or not

    Hi,
    I know how to convert strings to change strings to uppercase or lowercase, but is there any function to check, beforehand, if the field is in uppercase, for instance ? The intention here is simply to spare processing in situations where the string is already in uppercase, and thus not needing any further processing (given I want to turn the string into uppercase.)
    Thanks in advance,
    Avraham

    Hi Avraham ,
    To check whether the string is in upper case or not use CA keyward.
    To check  try the following code  ---
    DATA : W_STRING(5) TYPE C,
    W_ABCDE(26) TYPE C VALUE 'abcdefghijklmnopqrstuvwxyz'.
    w_string = 'abcd'.
    IF W_STRING CA W_ABCDE.
    TRANSLATE w_string TO UPPER CASE.
    ELSE.
    MESSAGE 'It is a uppercase string' TYPE 'S'.
    ENDIF.
    Try this link  this will definitely help you -
    https://wiki.sdn.sap.com/wiki/display/ABAP/Validationofastringintermsof+case
    Regards
    Pinaki

  • How check if a string contains a generic character?

    I want know how i can check if this string
    String mio= new String("Error 101");contains this substring
    1xxwhere "xx" are two generic characters that follow "1".
    Thanks
    Message was edited by:
    PremierITA

    Use a regular expression.Pattern threeDigitNumberThatStartsWith1 = Pattern.compile(".*1\\d\\d.*");
    Matcher matcher = pattern.matcher(mio);
    if(matcher.matches()) {
      // found it!
    else {
      // didn't find it
    }More about pattern matching here: http://java.sun.com/javase/6/docs/api/java/util/regex/Pattern.html

  • How to check the encoding of the String?

    hi everybody
    Could anyone tell how to tell from a String object in which encoding it is written? Is it UTF-8, UTF-16 etc. Is there any class that posses such a method. Another problem is that this solution must work under java 1.3.
    Thx in advance.

    Ok, but for example when you read from the file it
    can be encoded in the UTF-8 or ANSI coding. Yes, so you have to tell Java which encoding to use, or it will use your default encoding. Some of the I/O classes have constructors or methods that let you specify which encoding to use.
    Moreover
    when read from the request in a servlet it is usually
    encoded in the UTF-8 coding.If that's specified in the HTTP headers, then the core API classes that grab it before handing it to you will do the conversion I think.
    My question is how to
    determine the encoding. Maybe i wasn't clear enough
    in my previous post, sorry for that.In general, you can't just look at a file and know the encoding. You have to know, or have an external means to find out.

  • Check text in string AS3.0

    So for my Flash class in school I'm making a game, this game has a keypad in it that if you enter the right code it unlocks the door. I have most of it down but am still confused.
    So far I have a dynamic text box and when you hit the number buttons I'm using appendText() to add the number to the textbox. There's a clear button that clears the box, and an enter button to enter the code.
    buttonEnter.addEventListener(MouseEvent.CLICK,codeCheck);
    function codeCheck(e:MouseEvent):void {
              if (KEYPAD_TEXT.text == num1 + num2 + num3 + num4){
                        keypadUnlock = true;
                        trace(keypadUnlock);
              else {
                        KEYPAD_TEXT.text = String("Invalid");
                        trace(keypadUnlock);
    Above is the code I am currently using, if I click the enter button right now all it does is tell me the code is invalid wether the code is right or not. This is because I don't know how to check what is actually in the textbox. So if the correct code is 1234 and I enter 1234, how do I make the if statement check wether or not the string says 1234 so that I can set my keypadUnlock to true and unlock the door?
    If you need any more information please ask.

    use:
    kglad wrote:
    use:
    buttonEnter.addEventListener(MouseEvent.CLICK,codeCheck);
    function codeCheck(e:MouseEvent):void {
              if (KEYPAD_TEXT.text == String(num1)+String(num2)+String(num3)+String(num4)){
                        keypadUnlock = true;
                        trace(keypadUnlock);
              else {
                        KEYPAD_TEXT.text = String("Invalid");
                        trace(keypadUnlock);
    p.s.  please mark helpful/correct responses.

  • Want to know how to check for new line character in text file

    Hi All,
    I`m trying to read data from text file. However I`m not sure whether the data is in 1st line or nth line. Now I`m trying to read the text from the readline. But if text is "" and not NULL then my code fails. So I want to know how to check for new line character and go to next line to find the data. Please help.
    Thanks
    static int readandwriteFile(Logger logger,String filepath){
              BufferedWriter out = null;
              BufferedReader in = null;
              File fr = null;
              int get_count = 0;
              try     {
              if(new File(filepath).exists())
              fr= new File(filepath);
                        System.out.println("FileName: "+fr);
                   if(fr != null){
    in = new BufferedReader(new FileReader(fr));
                             String text = in.readLine();
                             if(text != null){
                             get_count = Integer.parseInt(text);
                             in.close();
                             else{
                                  get_count = 0;
         else{                    
    out = new BufferedWriter(new FileWriter(filepath));
         out.write("0");
                out.close();
                   }          //Reading of the row count file ended.
              catch(Exception e) {
                   e.printStackTrace();
              finally {
                   try{               if (in != null) {
                             in.close();
              if (out != null) {
                             out.close();
              catch(Exception e) {
                        e.printStackTrace();
              return get_count;
         }

    You are calling the readline() only once which means you are reading only the first line from the file...
    Use a loop (Do-While preferably)
    do{
    //your code
    }while(text == "")

  • How to check the verity version in our PeopleSoft Installation?

    How to check the verity version in our PeopleSoft Installation? I am not sure if the verity is installed or not and also if installed what is the version?

    yes. it says the version is 5.0.1
    Is there any difference in installation or configuration when the app and web server are in same machine and when the app and web server are installed in different servers?
    ============================================
    D:\fs840\webserv\peoplesoft>mkvdk
    mkvdk - Verity, Inc. Version 5.0.1 (_nti40, Jul 23 2004)
    Usage: mkvdk [<option>...] <filespec>...
    Where <option> can be a VDK switch, or any of:
    -about Show the collection's about resources
    -autodel Delete bulk insert file when no longer needed
    -backup <dir> Specify collection backup location
    -bulk Submit bulk insert file(s)
    -charmap <name> Specify the character map to VDK
    -collection <path> Specify the collection (required)
    -create Create the collection
    -credentials <user> Specify user[:passwd][:domain][:mailbox]
    -datapath <path> Specify VDK datapath
    -datefmt <fmt> Specify date format to VDK
    -debug Enable debugging output
    -delete Delete documents
    -description <desc> Set the collection's description
    -diskcache <num> Set VDK's disk cache size (kbytes)
    -extract Extract field values from text
    -help Print this usage information
    -insert Insert documents (default)
    -locale <locale> Specify the locale to VDK
    -logfile <file> Save output in a log file
    -loglevel <num> Set the VDK output level for the log
    -mailboxes This option is depracated. Use the credentials option inste
    ad
    -maxfiles <num> Set VDK's maximum number of open files
    -maxmemory <num> Set VDK's maximum memory usage (kbytes)
    -mode <mode> Set the indexing mode
    -modify Modify fields using field/value pairs from a bulkfile
    -nohousekeep Disable housekeeping
    -noindex Disable indexing
    -nolock Turns off locking (dangerous)
    -nooptimize Disable optimizations
    -nosave Don't save collection work list
    -noservice Prevents servicing of submitted work
    -nosubmit Don't submit work to VDK
    -numdocs <num> Number of documents to insert from bulk insert file(s)
    -numpages <num> Synonym for diskcache for backward compatibility
    -offset <num> Specify offset into bulk insert file(s)
    -online Flag for online Bulk Modify
    -optimize <spec> Optimize the collection
    -outlevel <num> Set the VDK output level
    -persist Service the collection forever
    -purge Remove all documents from collection
    -purgeback Purge in the background
    -purgewait <secs> Specify delay before purge
    -quiet Suppress all non-error messages
    -repair Repair the collection
    -servlev <spec> Advanced option for overriding service level
    -sleeptime <secs> Interval between service calls for persist
    -style <dir> Specify style directory for create
    -submit Synonym for noservice for backward compatibility
    -synch Perform work synchronously
    -topicset <path> Specify VDK topic set
    -update Update documents
    -vdkhome <path> Specify VDK home
    -verbose Output more information
    -words Build word assist list
    -wordindex Build word assist index
    The <spec> for -optimize is a hyphenated string of:
    maxmerge Perform maximal merging of partitions
    squeeze Recover space from deleted documents
    vdbopt Build optimized VDB's
    spanword Create word list spanning all partitions
    ngramindex Create ngram index into spanning word list
    maxclean Really clean (not for read-write)
    readonly Make the collection read-only
    tuneup Fully optimize for read-write use
    publish Fully optimize for read-only use
    The <spec> for -servlev is a hyphenated string of:
    search Enable search and retrieval
    insert Enable adding and updating documents
    optimize Enable opportunistic collection optimization
    assist Enable building of word list
    housekeep Enable housekeeping of unneeded files
    delete Enable document deletion
    backup Enable backup
    purge Enable background purging
    repair Enable collection repair
    dataprep Same as search-index-optimize-assist-housekeep
    index Same as insert-delete
    Error: must specify collection
    mkvdk done
    D:\fs840\webserv\peoplesoft>

Maybe you are looking for

  • BT Infinity issues and only been with them since 4...

    I have been so looking forward to faster broadband, religously checking the availability of infinity for my area for months and eventually hey-ho here it is. After having a HH3 on BT BB for years and not a single issue I thought awesome same reliabil

  • MBP/HDTV Resolution Mismatch

    Hi all, long time lurker here. I'm having a problem (obviously) getting my mbp (purchased june 2011) to connect to my shiny new insignia hdtv.  i've got a thunderbolt to hdmi that's working swimmingly, i've been able to get the sound out of the exter

  • DMS EKKO missing link from Object side

    Hello, i have created a new Document typ with Object links: IFLOT (functional location), EKKO (Purchase Order) (We have created a new Screen 9001 and implemented it in SAPCV130, SAPCV130 and set all needed customzing settings.) and LFA1 (Vendor). My

  • Displaying paramters in excel output

    Hi, I am designing a report in excel format, using the 'True Excel' method. Refering to the section "Declaring and Passing Parameters" in Link, it mentioned i can simply add this in the metadata worksheet. XDO_PARAM_?1? <?param@begin:Country;US?> XDO

  • Events getting lost

    Hi all, When setting a backing bean in session scope and then executing an action everything works like a charm. But if I set the the context to Request, then the event is not processed. Anyone has any idea why is this?