首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 软件管理 > 软件架构设计 >

截取字符串种工具类

2012-10-29 
截取字符串类工具类/**?* 截取字符串类?*/package testpublic class Split {?public static void main(St

截取字符串类工具类

/**
?* 截取字符串类
?*/
package test;

public class Split {

?public static void main(String[] args) {
??// String s1="an angelDeclan《Thank you》,I wish I had your pair of
??// wingsHad them last in my dreamsI, was chaising butterfliesTill the
??// sunrise broke my eyes";
??// String[] referealReasons = s1.split(",");
??// for(int m=0;m<referealReasons.length;m++){
??// // System.out.println(referealReasons[m]);
??// }
??// // 字符串1
??String abc = "abcdefg";
??// 字符串2
??String aa = "aa.|bb.|cc.|dd.|ee.|ff.|gg";
??String result = abc.substring(abc.length() - 3); // 截取后三位
??String result1 = abc.substring(2, 5);
??// 使用split方法,将字符串进行截取
??String[] result2 = aa.split("\\."+"\\|");
??for (int m = 0; m < result2.length; m++) {
???System.out.println("输出结果:" + result2[m]);
??}
?}
}

热点排行