<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<font face="serif">I was asked about the best way to convert a
String to an integer. By far the easiest thing to use is the
Integer.parseInt method<br>
<br>
So if I wanted to convert<br>
<br>
</font><tt>String integerAsAString = " 456</tt><tt> " </tt><font
face="serif"><br>
<br>
to <br>
<br>
</font><tt>i</tt><tt>nt integerValue = 456;</tt><font face="serif"><br>
<br>
I could use...<br>
<br>
<br>
</font><tt>int integerValue =
Integer.parseInt(integerAsAString.trim());</tt><font face="serif"><br>
<br>
<br>
</font>
<pre class="moz-signature" cols="72">--
Andrew J. Pounds, Ph.D. (<a class="moz-txt-link-abbreviated" href="mailto:pounds_aj@mercer.edu">pounds_aj@mercer.edu</a>)
Professor of Chemistry and Computer Science
Mercer University, Macon, GA 31207 (478) 301-5627
<a class="moz-txt-link-freetext" href="http://faculty.mercer.edu/pounds_aj">http://faculty.mercer.edu/pounds_aj</a>
</pre>
</body>
</html>