Java中如何判断一个字符串的格式
/**
* check if the odivalue has a legal version format[0.0.0.0]
* @param odivalue:The odivalue extracted from SOAP
* @return :a boolean value,true or false
*/
public static boolean isCorrectVersion(String odivalue) {
// TODO Auto-generated method stub
Pattern pattern = Pattern.compile("[0-9]*" + "." + "[0-9]*" + "." + "[0-9]*" + "." + "[0-9]*");
Matcher isNum = pattern.matcher(odivalue);
if( !isNum.matches() )
{
return false;
}
return true;
}
采用java.util.regex.Matcher和java.util.regex.Pattern进行处理
相关文档:
<!--
/* Font Definitions */
@font-face
{font-family:宋体;
panose-1:2 1 6 0 3 1 1 1 1 1;
mso-font-alt:SimSun;
mso-font-charset:134;
mso-generic-font-family:auto;
mso-font-pitch:variable;
mso-font-signature:3 135135232 16 0 262145 0;}
@font-face
{font-family:"\@宋体" ......
public class DeadLock {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
final Object resource1 = "resource1";
final Object resource2 = "resource2";
Thread t1 = new Thread(){
public void run(){
syn ......
在所有组件都放到JFrame之后,先setSize(),然后再setVisible() 。
设置了窗口的Size,布局管理器才能为各个组件安排合适的位置,之后再把窗体显示出来setVisible(),比如你还不知道厂房的大小,这时就无法决定设备安放的位置。 ......
今天是学习Android开发的第二天:
今天主要学习了文件的读取、以及对xml文件的解析:
使用文件进行数据存储:
Activity提供了openFileOutput()方法可以用于把数据输出到文件中,具体的实现过程与在J2SE环境中保存数据到文件中是一样的。
public class FileActivity extends Acti ......
今天是学习
Android
的第三天,今天主要学了
Android
内置的
SQLite
数据库,学习了增删改查。
SharedPreferences
进行数据存储
:
Android
平台给我们提供了一个
SharedPreferences
类,它是一个轻量级的存储类,特别适 ......