Try this code:
String c1idat = req.getParameterValues("C1IDAT")[0];
int c1idatint;
try {
int pos = c1idat.lastIndexOf(",");
c1idatint = Integer.parseInt(c1idat.substring(pos + 1));
} catch (NumberFormatException e) {
throw new ServletException("c1idat = " + c1idat + " (not an int value)");
}
Jeetandra Mahtani wrote:
>
> Hello,
> This probably is a really simple question but I can't
> seem to get it working.
> I have retrieved a field from a from by the following:
> ..
> String c1idat = req.getParameterValues("C1IDAT")[0];
> ..
> Now, I need to get the int value of this string.
> The field in the table is of type S ( db2/400 ).
> The parameters are as :
> String parameters = c1cono + ",'" + c1coco + "','" +
> c1colo + "','" + c1qsit + "','" + c1qusr + "','" +
> c1emfq + "','" + c1susr + "','" + c1emfs + "','" +
> c1pusr + "','" + c1emfr + "','" + c1cusr + "','" +
> c1emfc + "','" + c1ema1 + "','" + c1ema2 + "'," +
> c1idat;
> All the other fields are of type A and only c1idat is
> of type S.
> I am pretty sure that if I can get the int value of
> c1idat, I should be able to add it.
> Any suggestions?
>
> _________________________________________________________
> DO YOU YAHOO!?
> Get your free @yahoo.com address at http://mail.yahoo.com
>
> ___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html
begin:vcard
n:Gatto;Rog�rio
tel;fax:+55 19 451 6300
tel;home:+55 19 237 0213
tel;work:+55 19 451 6300
x-mozilla-html:FALSE
url:http://www.widesoft.com.br
org:WideSoft Sistemas Ltda;Development
version:2.1
email;internet:[EMAIL PROTECTED]
title:Systems Analyst
adr;quoted-printable:;;R. Dr. Quirino, 1001 ap 62=0D=0ACentro;Campinas;SP;13015081;Brazil
fn:Rog�rio Meneguelli Gatto
end:vcard