a whole bunch of stuff
[ephemerata.git] / Toady / lib / commons-lang-2.4 / apidocs / org / apache / commons / lang / NumberUtils.html
blobfcc0fb590841f70c7e17590a00d1e20beae09d17
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
2 <!--NewPage-->
3 <HTML>
4 <HEAD>
5 <!-- Generated by javadoc (build 1.4.2_16) on Sat Mar 15 20:43:47 PDT 2008 -->
6 <META http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
7 <TITLE>
8 NumberUtils (Commons Lang 2.4 API)
9 </TITLE>
11 <META NAME="keywords" CONTENT="org.apache.commons.lang.NumberUtils class">
13 <LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
15 <SCRIPT type="text/javascript">
16 function windowTitle()
18 parent.document.title="NumberUtils (Commons Lang 2.4 API)";
20 </SCRIPT>
22 </HEAD>
24 <BODY BGCOLOR="white" onload="windowTitle();">
27 <!-- ========= START OF TOP NAVBAR ======= -->
28 <A NAME="navbar_top"><!-- --></A>
29 <A HREF="#skip-navbar_top" title="Skip navigation links"></A>
30 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
31 <TR>
32 <TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
33 <A NAME="navbar_top_firstrow"><!-- --></A>
34 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
35 <TR ALIGN="center" VALIGN="top">
36 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
37 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
38 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
39 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/NumberUtils.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
40 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
41 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
42 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
43 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
44 </TR>
45 </TABLE>
46 </TD>
47 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
48 </EM>
49 </TD>
50 </TR>
52 <TR>
53 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
54 &nbsp;<A HREF="../../../../org/apache/commons/lang/NumberRange.html" title="class in org.apache.commons.lang"><B>PREV CLASS</B></A>&nbsp;
55 &nbsp;<A HREF="../../../../org/apache/commons/lang/ObjectUtils.html" title="class in org.apache.commons.lang"><B>NEXT CLASS</B></A></FONT></TD>
56 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
57 <A HREF="../../../../index.html" target="_top"><B>FRAMES</B></A> &nbsp;
58 &nbsp;<A HREF="NumberUtils.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
59 &nbsp;<SCRIPT type="text/javascript">
60 <!--
61 if(window==top) {
62 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
64 //-->
65 </SCRIPT>
66 <NOSCRIPT>
67 <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
68 </NOSCRIPT>
70 </FONT></TD>
71 </TR>
72 <TR>
73 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
74 SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
75 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
76 DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
77 </TR>
78 </TABLE>
79 <A NAME="skip-navbar_top"></A>
80 <!-- ========= END OF TOP NAVBAR ========= -->
82 <HR>
83 <!-- ======== START OF CLASS DATA ======== -->
84 <H2>
85 <FONT SIZE="-1">
86 org.apache.commons.lang</FONT>
87 <BR>
88 Class NumberUtils</H2>
89 <PRE>
90 java.lang.Object
91 <IMG SRC="../../../../resources/inherit.gif" ALT="extended by"><B>org.apache.commons.lang.NumberUtils</B>
92 </PRE>
93 <HR>
94 <B>Deprecated.</B>&nbsp;<I>Moved to org.apache.commons.lang.math.
95 Class will be removed in Commons Lang 3.0.</I>
96 <P>
97 <DL>
98 <DT>public final class <B>NumberUtils</B><DT>extends java.lang.Object</DL>
101 <p>Provides extra functionality for Java Number classes.</p>
105 <DL>
106 <DT><B>Since:</B></DT>
107 <DD>1.0</DD>
108 <DT><B>Version:</B></DT>
109 <DD>$Id: NumberUtils.java 488819 2006-12-19 21:50:04Z bayard $</DD>
110 <DT><B>Author:</B></DT>
111 <DD><a href="mailto:rand_mcneely@yahoo.com">Rand McNeely</a>, Stephen Colebourne, <a href="mailto:steve.downey@netfolio.com">Steve Downey</a>, Eric Pugh, Phil Steitz</DD>
112 </DL>
113 <HR>
116 <!-- ======== NESTED CLASS SUMMARY ======== -->
119 <!-- =========== FIELD SUMMARY =========== -->
122 <!-- ======== CONSTRUCTOR SUMMARY ======== -->
124 <A NAME="constructor_summary"><!-- --></A>
125 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
126 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
127 <TD COLSPAN=2><FONT SIZE="+2">
128 <B>Constructor Summary</B></FONT></TD>
129 </TR>
130 <TR BGCOLOR="white" CLASS="TableRowColor">
131 <TD><CODE><B><A HREF="../../../../org/apache/commons/lang/NumberUtils.html#NumberUtils()">NumberUtils</A></B>()</CODE>
133 <BR>
134 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;<code>NumberUtils</code> instances should NOT be constructed in standard programming.</TD>
135 </TR>
136 </TABLE>
137 &nbsp;
138 <!-- ========== METHOD SUMMARY =========== -->
140 <A NAME="method_summary"><!-- --></A>
141 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
142 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
143 <TD COLSPAN=2><FONT SIZE="+2">
144 <B>Method Summary</B></FONT></TD>
145 </TR>
146 <TR BGCOLOR="white" CLASS="TableRowColor">
147 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
148 <CODE>static&nbsp;int</CODE></FONT></TD>
149 <TD><CODE><B><A HREF="../../../../org/apache/commons/lang/NumberUtils.html#compare(double, double)">compare</A></B>(double&nbsp;lhs,
150 double&nbsp;rhs)</CODE>
152 <BR>
153 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;Compares two <code>doubles</code> for order.</TD>
154 </TR>
155 <TR BGCOLOR="white" CLASS="TableRowColor">
156 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
157 <CODE>static&nbsp;int</CODE></FONT></TD>
158 <TD><CODE><B><A HREF="../../../../org/apache/commons/lang/NumberUtils.html#compare(float, float)">compare</A></B>(float&nbsp;lhs,
159 float&nbsp;rhs)</CODE>
161 <BR>
162 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;Compares two floats for order.</TD>
163 </TR>
164 <TR BGCOLOR="white" CLASS="TableRowColor">
165 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
166 <CODE>static&nbsp;java.math.BigDecimal</CODE></FONT></TD>
167 <TD><CODE><B><A HREF="../../../../org/apache/commons/lang/NumberUtils.html#createBigDecimal(java.lang.String)">createBigDecimal</A></B>(java.lang.String&nbsp;val)</CODE>
169 <BR>
170 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;Convert a <code>String</code> to a <code>BigDecimal</code>.</TD>
171 </TR>
172 <TR BGCOLOR="white" CLASS="TableRowColor">
173 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
174 <CODE>static&nbsp;java.math.BigInteger</CODE></FONT></TD>
175 <TD><CODE><B><A HREF="../../../../org/apache/commons/lang/NumberUtils.html#createBigInteger(java.lang.String)">createBigInteger</A></B>(java.lang.String&nbsp;val)</CODE>
177 <BR>
178 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;Convert a <code>String</code> to a <code>BigInteger</code>.</TD>
179 </TR>
180 <TR BGCOLOR="white" CLASS="TableRowColor">
181 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
182 <CODE>static&nbsp;java.lang.Double</CODE></FONT></TD>
183 <TD><CODE><B><A HREF="../../../../org/apache/commons/lang/NumberUtils.html#createDouble(java.lang.String)">createDouble</A></B>(java.lang.String&nbsp;val)</CODE>
185 <BR>
186 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;Convert a <code>String</code> to a <code>Double</code>.</TD>
187 </TR>
188 <TR BGCOLOR="white" CLASS="TableRowColor">
189 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
190 <CODE>static&nbsp;java.lang.Float</CODE></FONT></TD>
191 <TD><CODE><B><A HREF="../../../../org/apache/commons/lang/NumberUtils.html#createFloat(java.lang.String)">createFloat</A></B>(java.lang.String&nbsp;val)</CODE>
193 <BR>
194 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;Convert a <code>String</code> to a <code>Float</code>.</TD>
195 </TR>
196 <TR BGCOLOR="white" CLASS="TableRowColor">
197 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
198 <CODE>static&nbsp;java.lang.Integer</CODE></FONT></TD>
199 <TD><CODE><B><A HREF="../../../../org/apache/commons/lang/NumberUtils.html#createInteger(java.lang.String)">createInteger</A></B>(java.lang.String&nbsp;val)</CODE>
201 <BR>
202 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;Convert a <code>String</code> to a <code>Integer</code>, handling
203 hex and octal notations.</TD>
204 </TR>
205 <TR BGCOLOR="white" CLASS="TableRowColor">
206 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
207 <CODE>static&nbsp;java.lang.Long</CODE></FONT></TD>
208 <TD><CODE><B><A HREF="../../../../org/apache/commons/lang/NumberUtils.html#createLong(java.lang.String)">createLong</A></B>(java.lang.String&nbsp;val)</CODE>
210 <BR>
211 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;Convert a <code>String</code> to a <code>Long</code>.</TD>
212 </TR>
213 <TR BGCOLOR="white" CLASS="TableRowColor">
214 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
215 <CODE>static&nbsp;java.lang.Number</CODE></FONT></TD>
216 <TD><CODE><B><A HREF="../../../../org/apache/commons/lang/NumberUtils.html#createNumber(java.lang.String)">createNumber</A></B>(java.lang.String&nbsp;val)</CODE>
218 <BR>
219 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;Turns a string value into a java.lang.Number.</TD>
220 </TR>
221 <TR BGCOLOR="white" CLASS="TableRowColor">
222 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
223 <CODE>static&nbsp;boolean</CODE></FONT></TD>
224 <TD><CODE><B><A HREF="../../../../org/apache/commons/lang/NumberUtils.html#isDigits(java.lang.String)">isDigits</A></B>(java.lang.String&nbsp;str)</CODE>
226 <BR>
227 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;Checks whether the <code>String</code> contains only
228 digit characters.</TD>
229 </TR>
230 <TR BGCOLOR="white" CLASS="TableRowColor">
231 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
232 <CODE>static&nbsp;boolean</CODE></FONT></TD>
233 <TD><CODE><B><A HREF="../../../../org/apache/commons/lang/NumberUtils.html#isNumber(java.lang.String)">isNumber</A></B>(java.lang.String&nbsp;str)</CODE>
235 <BR>
236 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;Checks whether the String a valid Java number.</TD>
237 </TR>
238 <TR BGCOLOR="white" CLASS="TableRowColor">
239 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
240 <CODE>static&nbsp;int</CODE></FONT></TD>
241 <TD><CODE><B><A HREF="../../../../org/apache/commons/lang/NumberUtils.html#maximum(int, int, int)">maximum</A></B>(int&nbsp;a,
242 int&nbsp;b,
243 int&nbsp;c)</CODE>
245 <BR>
246 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;Gets the maximum of three <code>int</code> values.</TD>
247 </TR>
248 <TR BGCOLOR="white" CLASS="TableRowColor">
249 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
250 <CODE>static&nbsp;long</CODE></FONT></TD>
251 <TD><CODE><B><A HREF="../../../../org/apache/commons/lang/NumberUtils.html#maximum(long, long, long)">maximum</A></B>(long&nbsp;a,
252 long&nbsp;b,
253 long&nbsp;c)</CODE>
255 <BR>
256 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;Gets the maximum of three <code>long</code> values.</TD>
257 </TR>
258 <TR BGCOLOR="white" CLASS="TableRowColor">
259 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
260 <CODE>static&nbsp;int</CODE></FONT></TD>
261 <TD><CODE><B><A HREF="../../../../org/apache/commons/lang/NumberUtils.html#minimum(int, int, int)">minimum</A></B>(int&nbsp;a,
262 int&nbsp;b,
263 int&nbsp;c)</CODE>
265 <BR>
266 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;Gets the minimum of three <code>int</code> values.</TD>
267 </TR>
268 <TR BGCOLOR="white" CLASS="TableRowColor">
269 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
270 <CODE>static&nbsp;long</CODE></FONT></TD>
271 <TD><CODE><B><A HREF="../../../../org/apache/commons/lang/NumberUtils.html#minimum(long, long, long)">minimum</A></B>(long&nbsp;a,
272 long&nbsp;b,
273 long&nbsp;c)</CODE>
275 <BR>
276 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;Gets the minimum of three <code>long</code> values.</TD>
277 </TR>
278 <TR BGCOLOR="white" CLASS="TableRowColor">
279 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
280 <CODE>static&nbsp;int</CODE></FONT></TD>
281 <TD><CODE><B><A HREF="../../../../org/apache/commons/lang/NumberUtils.html#stringToInt(java.lang.String)">stringToInt</A></B>(java.lang.String&nbsp;str)</CODE>
283 <BR>
284 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;Convert a <code>String</code> to an <code>int</code>, returning
285 <code>zero</code> if the conversion fails.</TD>
286 </TR>
287 <TR BGCOLOR="white" CLASS="TableRowColor">
288 <TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
289 <CODE>static&nbsp;int</CODE></FONT></TD>
290 <TD><CODE><B><A HREF="../../../../org/apache/commons/lang/NumberUtils.html#stringToInt(java.lang.String, int)">stringToInt</A></B>(java.lang.String&nbsp;str,
291 int&nbsp;defaultValue)</CODE>
293 <BR>
294 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<B>Deprecated.</B>&nbsp;Convert a <code>String</code> to an <code>int</code>, returning a
295 default value if the conversion fails.</TD>
296 </TR>
297 </TABLE>
298 &nbsp;<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
299 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
300 <TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
301 <TD><B>Methods inherited from class java.lang.Object</B></TD>
302 </TR>
303 <TR BGCOLOR="white" CLASS="TableRowColor">
304 <TD><CODE>clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
305 </TR>
306 </TABLE>
307 &nbsp;
310 <!-- ============ FIELD DETAIL =========== -->
313 <!-- ========= CONSTRUCTOR DETAIL ======== -->
315 <A NAME="constructor_detail"><!-- --></A>
316 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
317 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
318 <TD COLSPAN=1><FONT SIZE="+2">
319 <B>Constructor Detail</B></FONT></TD>
320 </TR>
321 </TABLE>
323 <A NAME="NumberUtils()"><!-- --></A><H3>
324 NumberUtils</H3>
325 <PRE>
326 public <B>NumberUtils</B>()</PRE>
327 <DL>
328 <DD><B>Deprecated.</B>&nbsp;<DD><p><code>NumberUtils</code> instances should NOT be constructed in standard programming.
329 Instead, the class should be used as <code>NumberUtils.stringToInt("6");</code>.</p>
331 <p>This constructor is public to permit tools that require a JavaBean instance
332 to operate.</p>
334 </DL>
336 <!-- ============ METHOD DETAIL ========== -->
338 <A NAME="method_detail"><!-- --></A>
339 <TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
340 <TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
341 <TD COLSPAN=1><FONT SIZE="+2">
342 <B>Method Detail</B></FONT></TD>
343 </TR>
344 </TABLE>
346 <A NAME="stringToInt(java.lang.String)"><!-- --></A><H3>
347 stringToInt</H3>
348 <PRE>
349 public static int <B>stringToInt</B>(java.lang.String&nbsp;str)</PRE>
350 <DL>
351 <DD><B>Deprecated.</B>&nbsp;<DD><p>Convert a <code>String</code> to an <code>int</code>, returning
352 <code>zero</code> if the conversion fails.</p>
354 <DD><DL>
355 <DT><B>Parameters:</B><DD><CODE>str</CODE> - the string to convert
356 <DT><B>Returns:</B><DD>the int represented by the string, or <code>zero</code> if
357 conversion fails</DL>
358 </DD>
359 </DL>
360 <HR>
362 <A NAME="stringToInt(java.lang.String, int)"><!-- --></A><H3>
363 stringToInt</H3>
364 <PRE>
365 public static int <B>stringToInt</B>(java.lang.String&nbsp;str,
366 int&nbsp;defaultValue)</PRE>
367 <DL>
368 <DD><B>Deprecated.</B>&nbsp;<DD><p>Convert a <code>String</code> to an <code>int</code>, returning a
369 default value if the conversion fails.</p>
371 <DD><DL>
372 <DT><B>Parameters:</B><DD><CODE>str</CODE> - the string to convert<DD><CODE>defaultValue</CODE> - the default value
373 <DT><B>Returns:</B><DD>the int represented by the string, or the default if conversion fails</DL>
374 </DD>
375 </DL>
376 <HR>
378 <A NAME="createNumber(java.lang.String)"><!-- --></A><H3>
379 createNumber</H3>
380 <PRE>
381 public static java.lang.Number <B>createNumber</B>(java.lang.String&nbsp;val)
382 throws java.lang.NumberFormatException</PRE>
383 <DL>
384 <DD><B>Deprecated.</B>&nbsp;<DD><p>Turns a string value into a java.lang.Number.</p>
386 <p>First, the value is examined for a type qualifier on the end
387 (<code>'f','F','d','D','l','L'</code>). If it is found, it starts
388 trying to create successively larger types from the type specified
389 until one is found that can hold the value.</p>
391 <p>If a type specifier is not found, it will check for a decimal point
392 and then try successively larger types from <code>Integer</code> to
393 <code>BigInteger</code> and from <code>Float</code> to
394 <code>BigDecimal</code>.</p>
396 <p>If the string starts with <code>0x</code> or <code>-0x</code>, it
397 will be interpreted as a hexadecimal integer. Values with leading
398 <code>0</code>'s will not be interpreted as octal.</p>
400 <DD><DL>
401 <DT><B>Parameters:</B><DD><CODE>val</CODE> - String containing a number
402 <DT><B>Returns:</B><DD>Number created from the string
403 <DT><B>Throws:</B>
404 <DD><CODE>java.lang.NumberFormatException</CODE> - if the value cannot be converted</DL>
405 </DD>
406 </DL>
407 <HR>
409 <A NAME="createFloat(java.lang.String)"><!-- --></A><H3>
410 createFloat</H3>
411 <PRE>
412 public static java.lang.Float <B>createFloat</B>(java.lang.String&nbsp;val)</PRE>
413 <DL>
414 <DD><B>Deprecated.</B>&nbsp;<DD><p>Convert a <code>String</code> to a <code>Float</code>.</p>
416 <DD><DL>
417 <DT><B>Parameters:</B><DD><CODE>val</CODE> - a <code>String</code> to convert
418 <DT><B>Returns:</B><DD>converted <code>Float</code>
419 <DT><B>Throws:</B>
420 <DD><CODE>java.lang.NumberFormatException</CODE> - if the value cannot be converted</DL>
421 </DD>
422 </DL>
423 <HR>
425 <A NAME="createDouble(java.lang.String)"><!-- --></A><H3>
426 createDouble</H3>
427 <PRE>
428 public static java.lang.Double <B>createDouble</B>(java.lang.String&nbsp;val)</PRE>
429 <DL>
430 <DD><B>Deprecated.</B>&nbsp;<DD><p>Convert a <code>String</code> to a <code>Double</code>.</p>
432 <DD><DL>
433 <DT><B>Parameters:</B><DD><CODE>val</CODE> - a <code>String</code> to convert
434 <DT><B>Returns:</B><DD>converted <code>Double</code>
435 <DT><B>Throws:</B>
436 <DD><CODE>java.lang.NumberFormatException</CODE> - if the value cannot be converted</DL>
437 </DD>
438 </DL>
439 <HR>
441 <A NAME="createInteger(java.lang.String)"><!-- --></A><H3>
442 createInteger</H3>
443 <PRE>
444 public static java.lang.Integer <B>createInteger</B>(java.lang.String&nbsp;val)</PRE>
445 <DL>
446 <DD><B>Deprecated.</B>&nbsp;<DD><p>Convert a <code>String</code> to a <code>Integer</code>, handling
447 hex and octal notations.</p>
449 <DD><DL>
450 <DT><B>Parameters:</B><DD><CODE>val</CODE> - a <code>String</code> to convert
451 <DT><B>Returns:</B><DD>converted <code>Integer</code>
452 <DT><B>Throws:</B>
453 <DD><CODE>java.lang.NumberFormatException</CODE> - if the value cannot be converted</DL>
454 </DD>
455 </DL>
456 <HR>
458 <A NAME="createLong(java.lang.String)"><!-- --></A><H3>
459 createLong</H3>
460 <PRE>
461 public static java.lang.Long <B>createLong</B>(java.lang.String&nbsp;val)</PRE>
462 <DL>
463 <DD><B>Deprecated.</B>&nbsp;<DD><p>Convert a <code>String</code> to a <code>Long</code>.</p>
465 <DD><DL>
466 <DT><B>Parameters:</B><DD><CODE>val</CODE> - a <code>String</code> to convert
467 <DT><B>Returns:</B><DD>converted <code>Long</code>
468 <DT><B>Throws:</B>
469 <DD><CODE>java.lang.NumberFormatException</CODE> - if the value cannot be converted</DL>
470 </DD>
471 </DL>
472 <HR>
474 <A NAME="createBigInteger(java.lang.String)"><!-- --></A><H3>
475 createBigInteger</H3>
476 <PRE>
477 public static java.math.BigInteger <B>createBigInteger</B>(java.lang.String&nbsp;val)</PRE>
478 <DL>
479 <DD><B>Deprecated.</B>&nbsp;<DD><p>Convert a <code>String</code> to a <code>BigInteger</code>.</p>
481 <DD><DL>
482 <DT><B>Parameters:</B><DD><CODE>val</CODE> - a <code>String</code> to convert
483 <DT><B>Returns:</B><DD>converted <code>BigInteger</code>
484 <DT><B>Throws:</B>
485 <DD><CODE>java.lang.NumberFormatException</CODE> - if the value cannot be converted</DL>
486 </DD>
487 </DL>
488 <HR>
490 <A NAME="createBigDecimal(java.lang.String)"><!-- --></A><H3>
491 createBigDecimal</H3>
492 <PRE>
493 public static java.math.BigDecimal <B>createBigDecimal</B>(java.lang.String&nbsp;val)</PRE>
494 <DL>
495 <DD><B>Deprecated.</B>&nbsp;<DD><p>Convert a <code>String</code> to a <code>BigDecimal</code>.</p>
497 <DD><DL>
498 <DT><B>Parameters:</B><DD><CODE>val</CODE> - a <code>String</code> to convert
499 <DT><B>Returns:</B><DD>converted <code>BigDecimal</code>
500 <DT><B>Throws:</B>
501 <DD><CODE>java.lang.NumberFormatException</CODE> - if the value cannot be converted</DL>
502 </DD>
503 </DL>
504 <HR>
506 <A NAME="minimum(long, long, long)"><!-- --></A><H3>
507 minimum</H3>
508 <PRE>
509 public static long <B>minimum</B>(long&nbsp;a,
510 long&nbsp;b,
511 long&nbsp;c)</PRE>
512 <DL>
513 <DD><B>Deprecated.</B>&nbsp;<DD><p>Gets the minimum of three <code>long</code> values.</p>
515 <DD><DL>
516 <DT><B>Parameters:</B><DD><CODE>a</CODE> - value 1<DD><CODE>b</CODE> - value 2<DD><CODE>c</CODE> - value 3
517 <DT><B>Returns:</B><DD>the smallest of the values</DL>
518 </DD>
519 </DL>
520 <HR>
522 <A NAME="minimum(int, int, int)"><!-- --></A><H3>
523 minimum</H3>
524 <PRE>
525 public static int <B>minimum</B>(int&nbsp;a,
526 int&nbsp;b,
527 int&nbsp;c)</PRE>
528 <DL>
529 <DD><B>Deprecated.</B>&nbsp;<DD><p>Gets the minimum of three <code>int</code> values.</p>
531 <DD><DL>
532 <DT><B>Parameters:</B><DD><CODE>a</CODE> - value 1<DD><CODE>b</CODE> - value 2<DD><CODE>c</CODE> - value 3
533 <DT><B>Returns:</B><DD>the smallest of the values</DL>
534 </DD>
535 </DL>
536 <HR>
538 <A NAME="maximum(long, long, long)"><!-- --></A><H3>
539 maximum</H3>
540 <PRE>
541 public static long <B>maximum</B>(long&nbsp;a,
542 long&nbsp;b,
543 long&nbsp;c)</PRE>
544 <DL>
545 <DD><B>Deprecated.</B>&nbsp;<DD><p>Gets the maximum of three <code>long</code> values.</p>
547 <DD><DL>
548 <DT><B>Parameters:</B><DD><CODE>a</CODE> - value 1<DD><CODE>b</CODE> - value 2<DD><CODE>c</CODE> - value 3
549 <DT><B>Returns:</B><DD>the largest of the values</DL>
550 </DD>
551 </DL>
552 <HR>
554 <A NAME="maximum(int, int, int)"><!-- --></A><H3>
555 maximum</H3>
556 <PRE>
557 public static int <B>maximum</B>(int&nbsp;a,
558 int&nbsp;b,
559 int&nbsp;c)</PRE>
560 <DL>
561 <DD><B>Deprecated.</B>&nbsp;<DD><p>Gets the maximum of three <code>int</code> values.</p>
563 <DD><DL>
564 <DT><B>Parameters:</B><DD><CODE>a</CODE> - value 1<DD><CODE>b</CODE> - value 2<DD><CODE>c</CODE> - value 3
565 <DT><B>Returns:</B><DD>the largest of the values</DL>
566 </DD>
567 </DL>
568 <HR>
570 <A NAME="compare(double, double)"><!-- --></A><H3>
571 compare</H3>
572 <PRE>
573 public static int <B>compare</B>(double&nbsp;lhs,
574 double&nbsp;rhs)</PRE>
575 <DL>
576 <DD><B>Deprecated.</B>&nbsp;<DD><p>Compares two <code>doubles</code> for order.</p>
578 <p>This method is more comprehensive than the standard Java greater
579 than, less than and equals operators.</p>
580 <ul>
581 <li>It returns <code>-1</code> if the first value is less than the second.
582 <li>It returns <code>+1</code> if the first value is greater than the second.
583 <li>It returns <code>0</code> if the values are equal.
584 </ul>
587 The ordering is as follows, largest to smallest:
588 <ul>
589 <li>NaN
590 <li>Positive infinity
591 <li>Maximum double
592 <li>Normal positive numbers
593 <li>+0.0
594 <li>-0.0
595 <li>Normal negative numbers
596 <li>Minimum double (-Double.MAX_VALUE)
597 <li>Negative infinity
598 </ul>
599 </p>
601 <p>Comparing <code>NaN</code> with <code>NaN</code> will
602 return <code>0</code>.</p>
604 <DD><DL>
605 <DT><B>Parameters:</B><DD><CODE>lhs</CODE> - the first <code>double</code><DD><CODE>rhs</CODE> - the second <code>double</code>
606 <DT><B>Returns:</B><DD><code>-1</code> if lhs is less, <code>+1</code> if greater,
607 <code>0</code> if equal to rhs</DL>
608 </DD>
609 </DL>
610 <HR>
612 <A NAME="compare(float, float)"><!-- --></A><H3>
613 compare</H3>
614 <PRE>
615 public static int <B>compare</B>(float&nbsp;lhs,
616 float&nbsp;rhs)</PRE>
617 <DL>
618 <DD><B>Deprecated.</B>&nbsp;<DD><p>Compares two floats for order.</p>
620 <p>This method is more comprehensive than the standard Java greater than,
621 less than and equals operators.</p>
622 <ul>
623 <li>It returns <code>-1</code> if the first value is less than the second.
624 <li>It returns <code>+1</code> if the first value is greater than the second.
625 <li>It returns <code>0</code> if the values are equal.
626 </ul>
628 <p> The ordering is as follows, largest to smallest:
629 <ul>
630 <li>NaN
631 <li>Positive infinity
632 <li>Maximum float
633 <li>Normal positive numbers
634 <li>+0.0
635 <li>-0.0
636 <li>Normal negative numbers
637 <li>Minimum float (-Float.MAX_VALUE)
638 <li>Negative infinity
639 </ul>
641 <p>Comparing <code>NaN</code> with <code>NaN</code> will return
642 <code>0</code>.</p>
644 <DD><DL>
645 <DT><B>Parameters:</B><DD><CODE>lhs</CODE> - the first <code>float</code><DD><CODE>rhs</CODE> - the second <code>float</code>
646 <DT><B>Returns:</B><DD><code>-1</code> if lhs is less, <code>+1</code> if greater,
647 <code>0</code> if equal to rhs</DL>
648 </DD>
649 </DL>
650 <HR>
652 <A NAME="isDigits(java.lang.String)"><!-- --></A><H3>
653 isDigits</H3>
654 <PRE>
655 public static boolean <B>isDigits</B>(java.lang.String&nbsp;str)</PRE>
656 <DL>
657 <DD><B>Deprecated.</B>&nbsp;<DD><p>Checks whether the <code>String</code> contains only
658 digit characters.</p>
660 <p><code>Null</code> and empty String will return
661 <code>false</code>.</p>
663 <DD><DL>
664 <DT><B>Parameters:</B><DD><CODE>str</CODE> - the <code>String</code> to check
665 <DT><B>Returns:</B><DD><code>true</code> if str contains only unicode numeric</DL>
666 </DD>
667 </DL>
668 <HR>
670 <A NAME="isNumber(java.lang.String)"><!-- --></A><H3>
671 isNumber</H3>
672 <PRE>
673 public static boolean <B>isNumber</B>(java.lang.String&nbsp;str)</PRE>
674 <DL>
675 <DD><B>Deprecated.</B>&nbsp;<DD><p>Checks whether the String a valid Java number.</p>
677 <p>Valid numbers include hexadecimal marked with the <code>0x</code>
678 qualifier, scientific notation and numbers marked with a type
679 qualifier (e.g. 123L).</p>
681 <p><code>Null</code> and empty String will return
682 <code>false</code>.</p>
684 <DD><DL>
685 <DT><B>Parameters:</B><DD><CODE>str</CODE> - the <code>String</code> to check
686 <DT><B>Returns:</B><DD><code>true</code> if the string is a correctly formatted number</DL>
687 </DD>
688 </DL>
689 <!-- ========= END OF CLASS DATA ========= -->
690 <HR>
693 <!-- ======= START OF BOTTOM NAVBAR ====== -->
694 <A NAME="navbar_bottom"><!-- --></A>
695 <A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
696 <TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
697 <TR>
698 <TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
699 <A NAME="navbar_bottom_firstrow"><!-- --></A>
700 <TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
701 <TR ALIGN="center" VALIGN="top">
702 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A>&nbsp;</TD>
703 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A>&nbsp;</TD>
704 <TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> &nbsp;<FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT>&nbsp;</TD>
705 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/NumberUtils.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A>&nbsp;</TD>
706 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A>&nbsp;</TD>
707 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A>&nbsp;</TD>
708 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A>&nbsp;</TD>
709 <TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A>&nbsp;</TD>
710 </TR>
711 </TABLE>
712 </TD>
713 <TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
714 </EM>
715 </TD>
716 </TR>
718 <TR>
719 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
720 &nbsp;<A HREF="../../../../org/apache/commons/lang/NumberRange.html" title="class in org.apache.commons.lang"><B>PREV CLASS</B></A>&nbsp;
721 &nbsp;<A HREF="../../../../org/apache/commons/lang/ObjectUtils.html" title="class in org.apache.commons.lang"><B>NEXT CLASS</B></A></FONT></TD>
722 <TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
723 <A HREF="../../../../index.html" target="_top"><B>FRAMES</B></A> &nbsp;
724 &nbsp;<A HREF="NumberUtils.html" target="_top"><B>NO FRAMES</B></A> &nbsp;
725 &nbsp;<SCRIPT type="text/javascript">
726 <!--
727 if(window==top) {
728 document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
730 //-->
731 </SCRIPT>
732 <NOSCRIPT>
733 <A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
734 </NOSCRIPT>
736 </FONT></TD>
737 </TR>
738 <TR>
739 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
740 SUMMARY:&nbsp;NESTED&nbsp;|&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_summary">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_summary">METHOD</A></FONT></TD>
741 <TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
742 DETAIL:&nbsp;FIELD&nbsp;|&nbsp;<A HREF="#constructor_detail">CONSTR</A>&nbsp;|&nbsp;<A HREF="#method_detail">METHOD</A></FONT></TD>
743 </TR>
744 </TABLE>
745 <A NAME="skip-navbar_bottom"></A>
746 <!-- ======== END OF BOTTOM NAVBAR ======= -->
748 <HR>
749 Copyright © 2001-2008 <a href="http://www.apache.org/">The Apache Software Foundation</a>. All Rights Reserved.
750 </BODY>
751 </HTML>