To find out if the value in string is double or integer

Hello,
I am getting a value from a db which is a string,but some of those
values could be doubles or integers
is there a way to check a string as if it were a double or int,
something like
String s="25.05"; //a double but is a string
if(isDouble.s){
//do some
the point is that I am not sure which string might have a double or int value
so I would rather test every string,and if they are double or float then proces or
else if they are not the do something else with them,
Help is greatly appreciated

Hi,
One possible solution is to parse the String into a double and catch the exception:
String s="25.05";
try {
Double dbl = new Double(s);
// do some
} catch (NumberFormatException ex) {}Hope this helps,
Kurt.

Similar Messages

  • How to find out all the text elements in the report using Java?

    How to trace the contents of an rpt file?
    I am able to open the rpt file in my report viewer but can not trace it using the JAVA code.
    Actually, I need to find out all the text elements of rpt (Report) file and replace them with the contents of resource bundle.
    My Java code to open a report is given below:
    import com.crystaldecisions.reports.sdk.ISubreportClientDocument;
    import com.crystaldecisions.reports.sdk.ParameterFieldController;
    import com.crystaldecisions.reports.sdk.ReportClientDocument;
    import com.crystaldecisions.sdk.occa.report.data.ConnectionInfo;
    import com.crystaldecisions.sdk.occa.report.data.ConnectionInfos;
    import com.crystaldecisions.sdk.occa.report.data.Fields;
    import com.crystaldecisions.sdk.occa.report.data.IConnectionInfo;
    import com.crystaldecisions.sdk.occa.report.data.ParameterField;
    import com.crystaldecisions.sdk.occa.report.data.ParameterFieldDiscreteValue;
    import com.crystaldecisions.sdk.occa.report.data.Values;
    import com.crystaldecisions.sdk.occa.report.lib.IStrings;
    import com.crystaldecisions.sdk.occa.report.lib.PropertyBag;
    import com.crystaldecisions.sdk.occa.report.lib.PropertyBagHelper;
    import com.crystaldecisions.sdk.occa.report.lib.ReportSDKException;
    import com.crystaldecisions.sdk.occa.report.reportsource.IReportSource;
    public String viewRpt()
                   //1.) Setting Database Infos
                            IConnectionInfo iConnectionInfoObj=setDatabaseConnectionInfos();
                   //2.) Setting Report Path
                   String reportPath=u201DE:
    was60
    rptFilesLocation
    u201D;
                   reportPath=(reportPath!=null)?                                             reportPath:AppConstants.CONSTANTS.BLANK;
                   String reportName="report1.rpt";
                   String reportFullPath = reportPath +   rptName;
                 //3.) Setting Report Source
                             ReportClientDocument reportClientDoc = new ReportClientDocument();
                                              reportClientDoc.open(reportPath, 0);
                  IReportSource reportSource = reportClientDoc.getReportSource();
                  setReportSource(reportSource);
                  reportClientDoc.close();
              //4.) Setting the Fields Starts
              setFieldsCrystal(null);
              Fields fields = new Fields();
              ParameterField pfield1 = new ParameterField();
              Values vals1 = new Values();
              ParameterFieldDiscreteValue pfieldDV1 = new ParameterFieldDiscreteValue();
              pfield1.setName("@parameter1");
              pfieldDV1.setValue(u201Cvalue1u201D);
              vals1.add(pfieldDV1);
              pfield1.setCurrentValues(vals1);
              fields.add(pfield1);
              pfield1 = new ParameterField();
              vals1 = new Values();
              pfieldDV1 = new ParameterFieldDiscreteValue();
              pfield1.setName("@parameter2");
              pfieldDV1.setValue(u201Cvalue2u201D);
              vals1.add(pfieldDV1);
              pfield1.setCurrentValues(vals1);
              fields.add(pfield1);
              setFieldsCrystal(fields);
              //Setting the Fields Ends
    The sample jsp code to view the report is as follows:
    <%@taglib uri="http://www.businessobjects.com/jsf/crystalreportsviewers"
         prefix="bocrv"%>
    <bocrv:reportPageViewer viewerName="CrystalViewer"
                                                 reportSource="#{CrystalReportBeanObject.reportSource}"
                                                 displayToolbarRefreshButton="false"
                                                 allowDatabaseLogonPrompting="false"
                                                 allowParameterPrompting="false"
                                                 databaseLogonInfos="#{CrystalReportBeanObject.connectionInfosCrystal}"
                                                 parameterFields="#{CrystalReportBeanObject.fieldsCrystal}"
                                                 displayGroupTree="false" displayToolbarLogo="false"
                                                 displayToolbarToggleTreeButton="false"
                                                 enablePageToGrow="false" height="540"
                                                 zoomPercentage="100" width="750"
                                                 allowDrillDown="false"
                                                 displayToolbarPrintButton="true"
                                                 printMode="PDF"
                                                 ></bocrv:reportPageViewer>
    Edited by: JayKumarSharma on Mar 23, 2011 12:42 PM

    This is how you retrieve all the text fields in the reort:
    ReportObjects reportObjects = (ITextObject) oReportClientDocument.getReportDefController().getReportObjectController().getReportObjectsByKind(ReportObjectKind.text);
    for(int i=0; i< reportObjects.size();i++)
    ITextObject textObject = (ITextObject)reportObjects.get(i);
    // use ReportObjectController to modify the text object.
    If you want to modify the contents of the text element, you can do it as follows:
    TextObject oTextObject = new TextObject();
    Paragraphs oParagraphs = new Paragraphs();
    Paragraph oParagraph = new Paragraph();
    ParagraphElements oParagraphElements = new ParagraphElements();
    ParagraphTextElement oParagraphTextElement = new ParagraphTextElement();
    oParagraphTextElement.setText("This is the new text field");
    oParagraphTextElement.setKind(ParagraphElementKind.text);
    oReportClientDocument.getReportDefController().getReportObjectController().modify(textObject, oTextObject);
    oReportClientDocument.save();

  • How do I find out if the pressed key is printable?

    I have made a game and now I'm working on a hiscore table for it. But with my function the program doesn't know if the pressed key is printable or if it's shift, ctrl or something like that. And I made it possible to enter maximum 40 letters as name, so if the user holds the shift key for a while then the whole String is filled with shift characters and nothing shows on the screen and he/she isn't able to type in any more letters... So is there any way to find out if the pressed key contains a printable char?
    This is what my function looks like now. My program is quite big so I just post the function and try to explain what is happening
    /* high is an array of
    int score;
    String name;
    boolean WritingName;
    boolean GAMEOVER;
    boolean newgame;
    public void keyPressed(KeyEvent e) {
         if (GAMEOVER){  // checks if the game has ended
             char button = e.getKeyChar();
             int keyCode = e.getKeyCode();
             if (newgame){  // this is false if the hi-score list is showing otherwise its true. i.e. its true when typing name for hiscore list
                   if (keyCode == 10) {       // check if the pressed key is enter
                        WritingName = false;  // Tells an other function that the user has finished typing his/her name so it can save it and start showing the hiscore-list on the screen
                   } else {
                        if (keyCode == 8){    // check if the pressed key is backspace and if so removes the last char from the string
                             if (high[99].name.length() > 0){
                                  high[99].name=high[99].name.substring(0,high[99].name.length()-1); 
                        } else {  // if any other key is pressed then add it to the end of the string
                             if (high[99].name.length() <= 40 ) high[99].name += button;
                   paint(getGraphics());
              } else {  // checks if space is pressed to stop showing the hiscore-list and start a new game
                   if (keyCode == 32) newgame = true;
    }

    But with my function the program doesn't know if the pressed key is printable or if it's shift, ctrl
    or something like thatProbably the easiest way is to check and see if e.getKeyChar() < a space character or if e.getKeyCode() >= 127. You can use e.getModifiers() to get the modifier, etc... -- take a look at the documentation for java.awt.event.KeyEvent class.
    V.V.

  • After burning a successful DVD in iDVD out of FCPX, how can I see the settings it used?   So I finally burned a DVD out of a Apple Pro Res file into iDVD in PAL format. My question now is how can I find out what the exact burn properties were so that I ca

    After burning a successful DVD in iDVD out of FCPX, how can I see the settings it used?
    So I finally burned a DVD out of a Apple Pro Res file into iDVD in PAL format. My question now is how can I find out what the exact burn properties were so that I can apply the same burn properties to a project in Compressor 4?
    Is it possible to see what iDVD did?

    I don't know any way you can interrogate iDVD to reveal settings to the extent that you can in a Compressor project. What you could do is open up the show's VOB in MPEG STreamclip, go to File and Reveal Stream Information; that will at least give you some rudimentary info like average bit rate. Perhaps someone, with more iDVD experience, can chime in here.
    The broader question is why use Compressor at all if your current workflow is doing the job to your satisfaction?
    The value of Compressor is that it gives you control over the many parameters that affect size quality.  and playability. The Compressor presets can give you a starting point for DVD delivery, Web, etc. From those presets, people typically experiment by adjusting the parameters until they get the desired results for their specific show. It's a little bit science and a little bit art. After experimenting, you may be able to get slightly better quality for the project you've successfully burned in iDVD by using Compressor and something likeToast…or maybe not.
    Good luck.
    Russ

  • How can i find out all the different meanings of  User ID Paramtrs (USR05)?

    Dear Gurus
    How can i find out all the different meanings of  User ID Parameters (table USR05)?
    Thanks
    Nuno Natividade

    hi,
       the values are stored in the table tpara and they are used to put the landscape of the system,and to know the log of the system.
      FORM DETERMINE_LANDSCAPE .
        SELECT SINGLE * FROM USR05
                        WHERE BNAME = SY-UNAME
                            AND PARID = 'ZLANDSCAPE'.
        IF SY-SUBRC = 0.
          IF NOT USR05-PARVA IS INITIAL.
       REPLACE
          ELSE.
            PERFORM DETERMINE_FROM_CENTRAL_SYSTEM.
          ENDIF.
        ELSE.
          PERFORM DETERMINE_FROM_CENTRAL_SYSTEM.
        ENDIF.
      ENDFORM.                    " determine_landscape
      FORM DETERMINE_LOG_PARAMETER.
        SELECT SINGLE * FROM USR05 WHERE BNAME = SY-UNAME
                            AND PARID = 'ZLOG_USER'
                            AND PARVA = 'X'.
        IF SY-SUBRC = 0.
          WITH_LOG = 'X'.
        ENDIF.
    <REMOVED BY MODERATOR>
    venkat.
    Edited by: Alvaro Tejada Galindo on Mar 4, 2008 12:47 PM

  • Still can't find out where the wrong is.....

    Here is the code I use to convert a String of infix expression
    into a postfix array.
    But I still can't find out where the problem is,can someone help me out, thanks...
    public void i2p(String i,char p[])
           int position ,outpos = 0;
           char topsymb = '+', symb, del;
           Stack opstk = new Stack(20);
           System.out.println("the original infix expression is: " + i);
           for(position=0 ; position< i.length() ; position++)
                symb = i.charAt(position);
                if(isoperand(symb))
                   p[outpos++] = symb;
                else
                     if(!opstk.empty()){
                          topsymb = opstk.pop();
                     prcdNum(topsymb, symb);
                     while(opstk.empty() == false && prcd(topsymb, symb) == true )
                     del = opstk.pop();
                     p[outpos++] = topsymb;
                     if(opstk.empty() == false && prcd(topsymb, symb) == false){
                        opstk.push(topsymb);
                        p[outpos++] = symb;
                     if(opstk.empty() == true && symb != ')'){
                        opstk.push(symb);
               while(!opstk.empty())
                 p[outpos++] = opstk.pop();
      }

    For example when I input a+b*c , it output abc* ,,,,,,,

  • 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

  • How do i find out who the carrier is and can i get it unlocked to use in australia?

    Hi there,
    I got a iphone4 from my friend ewho brought it from someone from ebay in the states
    I am unable to use the phone and was told that the phone had been updated to a baseband that can not be unlocked
    and that I need to contact the carrier.
    How do I find out who the carrier is and is there anyway I can get it unlocked to be used in Australia?
    It has a grevey sim in it and well at this point in time its just being used as an ipod.
    Yes I know I should of got one from Australia but i thought it wouldnt be this hard to get it fixed to be able to use here.
    please help........
    thanx
    lana

    The discussion of Jailbroken Devices is against the Terms of Use of this Forum.
    http://support.apple.com/kb/HT3743

  • I have files that may have been created in various versions of Illustrator. We need to be able to open them, but all we have is CS6 suite. I have called and been told that "technicians at adobe" could perform a paid service to find out what the files were

    I have files that may have been created in various versions of Illustrator. We need to be able to open them, but all we have is CS6 suite. I have called and been told that "technicians at adobe" could perform a paid service to find out what the files were created in and get them to be useable in InDesign 6, but I'd need an email address that was registered to our software to give the help desk person. After finding the correct email address, different adobe help number people told me to come here to ask as there is no phone support. Can anyone get me to an adobe technician that can provide a price quote for finding out what created these files and for getting them converted? Thanks.

    Sorry, I understood you to say you had the whole CS6 suite, which includes Illustrator.
    As far as finding out what the files are, sometimes you can look at them in a text editor to figure this out. See below; the, Creator Tool line. Not every software package makes it this easy, though.

  • I am trying to add my sons email address to our family apple id but it says that it already associated with another apple id. How can i find out what the apple id is and take his email address off that one?

    I am trying to add my sons email address to our family apple id but it says that it already associated with another apple id. How can i find out what the apple id is and take his email address off that one?

    You may be able to find your Apple ID at Look up your old and forgotten Apple ID

  • How do I find out what the resolution of a video file is in snow leopard

    I have a video file and am wandering how do I find out what the resolution of the video is?

    sometimes right click on the file, and getting info may show the resolution.

  • How do i find out if the server admin daemon is running

    Hi All,
    I've got an OS X server that for some reason ( probably due to me pratting around) has decided not to have a working server admin prog. I can fire up the client program and point it at any of the IP addresses that the server is looking at and then you get an error message basically saying that the server admin daemon is not contactable.
    So ...
    1). How can i find out if the back end daemon is running
    2). what port(s) does it listen on
    3). How can I turn on some logging to see what's happening when I run serve admin
    4). Any other tips as to how to find out why its not working
    Rgds
    Alex

    You should post this in one of the forums in the Mac OS X Server v10.5 Leopard category. You'll get better response there.

  • How do I find out who the BB provider is at my pro...

    brief history.
    Bought my existing property in july2012 .
    Ordered BT combined phone and BB package 2 with 40Gb and free calls August 8th 2012
    took BT 5 xweeks to connect my phone line although there was an existing line working at the house .?
    Also 5xweeks to connect the BTHub3 broadband.
    Today i learn that BT cancelled my BT broadband service over a month ago because there was a previous broadband provider still active at the property .
    I am now told that my BT router has been connected to an unknown ISP for the past 6x weeks ????
    How can I find out who the ISP is so I can cancel it as I cannot contact the previous property owner.
    BT have not advised me of any of this by the way. If I hadn't phoned today to query why I have no caller ID or answerphone service or email address and my number isn't ex dir as requested then I'd never have known

    If you go to www.speedtest.net it will display which ISP you're with in the bottom corner. There are a few other websites which tell you too but the URLs escape me at the minute
    Dean
    BTCare Community Mod
    If you like a post, or want to say thanks for a helpful answer, please click on the Ratings star on the left-hand side of the post.
    If someone answers your question correctly please let other members know by clicking on ’Mark as Accepted Solution’.

  • I have a new 16g nano and I have only added about 600 songs and I only have less than a gig left of space.  It says I have used over 9G of other.  I have no movies, pictures, tv shows or anything else on it.  How do I find out what the "other" is?

    I have a new 16g nano.  I have only added about 600 songs so far.  It is telling me that I 4.47G of songs and 9.92G of other and only 3.297MB of space left.  I have no tvshows, no movies, no pictures on the Ipod.  How do I find out what the "other" is and get rid of it? 

    You most likely have some corrupted files in other. Restore it and resync.

  • How do I find out what the charges on my credit card are for? Where is the iTunes account to log into and check?

    How do I find out what the charges are on my credit card are for. Where is the iTunes account to sign in and check?

    Launch iTunes then select iTunes Store from the source list left side of the window.
    Click Sign In on the right side of the window just above Quick Links.
    Now click your account name.
    In the next window click See All to the right of Purchase History.

Maybe you are looking for

  • My ipod is not working at all

    I charge my ipod to the computer and the adapter and it wont charge. i also have had it charged before and still wont work. Its like completly dead and annoying

  • Do you have any idea, what makes to fix this error in creating PO.

    The error is u201CDocument 101600 does not existu201D Do you have any idea, what makes to fix this error in creating PO.The error is u201CDocument 101600 does not existu201D  Here the 101600 is PO no.

  • Cannot open iTunes on Windows 7

    I was getting an error when I tried to open iTunes that said "iTunes has stopped working" and it asked me if I wanted to send the problem to Microsoft. The error appeared after about a minute after clicking to try to open it. I am running Windows 7,

  • Adding a title to a still image in iMovie for iPhone 4

    I would like to add a title for a still image using iMovie for iPhone 4. Is this possible? I can't see an option for this and it seems simple enough. I can add titles on video clips, but not on still images. Any suggestions?

  • Lightroom displays colors differently than Photoshop

    Lightroom (and my image previewer - IfranView) display my image colors differently than photoshop.  This is very disturbing (why can't Adobe make this simple!)!  Image in question - see below.  Center image is Photoshop, left is Lr 4 and right is Inf