驗證Email和格式化Double貨幣
来源:互联网 发布:word数据复制到excel 编辑:程序博客网 时间:2024/06/05 09:49
1、驗證email
import java.util.regex.Matcher;import java.util.regex.Pattern;public class MyEmailVal {public static boolean isEmail(String email){//\\w+@(\\w+.)+[a-z]{2,3}String check = "\\w+@(\\w+.)+[a-z]{2,3}";Pattern regex = Pattern.compile(check);Matcher matcher = regex.matcher(email); return matcher.matches();}}
2、Double貨幣 格式轉為222,222.00
import java.text.DecimalFormat;public class MyCurrencyFormat {public static String getFormatCurrency(double money){DecimalFormat myformat = new DecimalFormat("#####0.00");String m = myformat.format(money);String head = m.substring(0,m.length()-3);String point = m.substring(m.length()-3, m.length());int len = head.length();int count = len/3;int y = len%3;if(count<1){return m;}else{String headDoc = "";if(y>0){headDoc = headDoc+ head.substring(0,y)+",";}for(int i=0;i<count;i++){headDoc = headDoc+ head.substring(y+i*3, y+i*3+3)+",";}headDoc = headDoc.substring(0,headDoc.length()-1);return headDoc + point;}}}
- 驗證Email和格式化Double貨幣
- 格式化double
- 时间和double类型数据的格式化
- 格式化double数据
- double 的格式化 输出
- java double数据类型格式化
- double的格式化输出
- 【学习笔记】double格式化
- [double]格式化输出
- 格式化Double变量
- float & double & 格式化输出
- double四舍五入格式化
- DecimalFormat 与double格式化
- double 和 long double
- java格式化double成string
- 【转载】fscanf和fprintf函数从文件中格式化读取double型数据
- email驗證
- Double和double的区别
- 用 const 限定类的成员函数
- Erlang 聊天室程序(八) 主题房间---supervisor 的使用
- Eclipse调试Android工具集锦之三-ADB
- 堆栈啥的2
- iOS中nil与NULL的区别
- 驗證Email和格式化Double貨幣
- boj-311-小马过河
- 使用AIDL(Android接口描述语言)设计和使用远程接口
- 获取USB设备的信息
- java获取mac地址-屏蔽ip封mac地址
- 推荐一种快速提高英语口语的方法
- 为嵌入式Linux安装eldk开发环境
- Java引用类型(总结)
- 工作后的学习