• Post Reply Bookmark Topic Watch Topic
  • New Topic

convert varchar to double  RSS feed

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.. i'm quite new with jsp.. can somebody help me..

i have a data type varchar(4).. value like 0050, 5555 etc..
so i want to convert the varchar type to double.. my code is like this
<%
DecimalFormat twoPlaces = new DecimalFormat("00.00");
tariff = Double.parseDouble(rs.getString("cp_tariff"));
%>
<td bgcolor="#C6F4F4"><%out.println(twoPlaces.format(tariff));%></td>

however the output is like this 0050 -> 50.00
5555 -> 5555.55

i would like my output display like 0050 -> 00.50
55.55

thanks in advance...
 
Author and ninkuma
Marshal
Posts: 66307
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The conversion issue isn't really a JSP problem so I'm going to move this post to the Java in General(intermediate) forum where it will get the proper attention.
[ June 03, 2004: Message edited by: Bear Bibeault ]
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!