String to integer


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 4 of 4

Thread: String to integer

  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




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


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center