DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Results 1 to 4 of 4
  1. #1
    Jabber Guest

    String to integer


    Hi,

    I'm searching for a way to convert a string to an integer.
    In a Jsp I call something from a database. Then I make an
    diagram as follows :

    <IMG SRC="/images/red.gif" width="10"
    height="<%= rs.getString("Waarde_num") %>">

    But Waarde_num is way to big. So I wanted to make it smaller,
    like <%= rs.getString("Waarde_num") %> / 100. The way this isn't gonna work
    because of <%= rs.getString("Waarde_num") %> is a string.

    Please help me !!
    Thanx in regards,
    Jaap

  2. #2
    Paul Clapham Guest

    Re: String to integer

    If the database field is actually an integer then read it from the database
    as an integer:

    rs.getInt("Waarde_num")

    PC2

    "Jabber" <meemsj@vertis.nl> wrote in message news:3c736ddc$1@10.1.10.29...
    >
    > Hi,
    >
    > I'm searching for a way to convert a string to an integer.
    > In a Jsp I call something from a database. Then I make an
    > diagram as follows :
    >
    > <IMG SRC="/images/red.gif" width="10"
    > height="<%= rs.getString("Waarde_num") %>">
    >
    > But Waarde_num is way to big. So I wanted to make it smaller,
    > like <%= rs.getString("Waarde_num") %> / 100. The way this isn't gonna

    work
    > because of <%= rs.getString("Waarde_num") %> is a string.
    >
    > Please help me !!
    > Thanx in regards,
    > Jaap




  3. #3
    ron Guest

    Re: String to integer



    If its stored as a String you can use the Integer.parseInt() to parse a signed
    decimal integer from a String.

    "Jabber" <meemsj@vertis.nl> wrote:
    >
    >Hi,
    >
    >I'm searching for a way to convert a string to an integer.
    >In a Jsp I call something from a database. Then I make an
    >diagram as follows :
    >
    ><IMG SRC="/images/red.gif" width="10"
    >height="<%= rs.getString("Waarde_num") %>">
    >
    >But Waarde_num is way to big. So I wanted to make it smaller,
    >like <%= rs.getString("Waarde_num") %> / 100. The way this isn't gonna work
    >because of <%= rs.getString("Waarde_num") %> is a string.
    >
    >Please help me !!
    >Thanx in regards,
    >Jaap



  4. #4
    Paul Gregoire Guest

    Re: String to integer


    If its already an Int in your DB then you can do the following:
    <%= rs.getInt("Waarde_num") / 100 ) %>

    or if it is infact not already an Int then you can do this:
    <%= Integer.parseInt(rs.getString("Waarde_num")) / 100 ) %>

    >>Hi,
    >>
    >>I'm searching for a way to convert a string to an integer.
    >>In a Jsp I call something from a database. Then I make an
    >>diagram as follows :
    >>
    >><IMG SRC="/images/red.gif" width="10"
    >>height="<%= rs.getString("Waarde_num") %>">
    >>
    >>But Waarde_num is way to big. So I wanted to make it smaller,
    >>like <%= rs.getString("Waarde_num") %> / 100. The way this isn't gonna

    work
    >>because of <%= rs.getString("Waarde_num") %> is a string.
    >>
    >>Please help me !!
    >>Thanx in regards,
    >>Jaap




Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links