java,php,asp.net,linux,javascript,mysql,mssql,oracle,编程

java substring截取字符串 汉字和字母

 1 int i=0
 2     String tempstr="";
 3     for(int j=0;j <str.length();j++)
 4     { 
 5     i=i+String.valueOf(str.charAt(j)).getBytes().length; 
 6     if(i <=25){ 
 7     tempstr=tempstr+String.valueOf(str.charAt(j)); 
 8     }
 9     }
10     if(tempstr.length()!=str.length())
11      {
12      str=tempstr+""
13      }
14 

posted on 2009-06-17 12:16 rrong_m 阅读(2964) 评论(0)  编辑  收藏

<2009年6月>
31123456
78910111213
14151617181920
21222324252627
2829301234
567891011

导航

统计

常用链接

随笔档案

文章分类

文章档案

java编程

搜索

积分与排名

最新评论

阅读排行榜

评论排行榜