Apache Commons Lang可去其官網處下載:
http://commons.apache.org/proper/commons-lang/download_lang.cgi
像我便是下載commons-lang3-X.X-bin.zip,解壓縮後把其中的jar檔匯入到Eclipse的Project內。
接著撰寫程式:
是文字便為false,是數字便為true。
- import java.util.*;
- import org.apache.commons.lang3.math.NumerUtils;
- public class XXX {
- public static void main(String[] args)
- {
- String testString = "A1";
- System.out.rintln( NumberUtils.isNumber( testString ) );
- }
- }
沒有留言:
張貼留言