截取字符

public class tttttt
{

/**
* @param args
*/
public static void main(String[] args)
{

String a = "1234567890abcde";

String[] str = splitMsg(a);

for(String ss:str)
{
System.out.println(ss);
}

}

/**
* 计算短信的长度,如果是长短信,需要进行拆分
*
*/
private static String[] splitMsg(String msgcontent)
{
String maxMsgLength = "10";
int msgLength = Integer.parseInt(maxMsgLength);
int count = 0;
for (int i=0;i<msgcontent.length();i++)
{
char d=msgcontent.charAt(i);
if (d >= 0x4e00 && d <= 0x9fa5)
{
count++;
}

}
count += msgcontent.length();

if(count > msgLength)
{
int sum =count%msgLength==0?count/msgLength:count/msgLength+1;
String[] str = getStrList(count,sum,msgcontent);

return str;
}

String[] content = new String[1];
content[0] = msgcontent;
return content;
}

public static String[] getStrList(int count,int sum,String context)
{

String [] str= new String[sum];
String maxMsgLength = "10";
int msgLength = Integer.parseInt(maxMsgLength);
int endchina=0;
for(int j=0;j<sum;j++)
{
int max =endchina+msgLength;
int min=endchina;
boolean chargit=false;//

int i=0;
if(j!=0)
{
i=endchina;
}
int xcount=0;
for( ;i<context.length();i++)
{
xcount++;
char d=context.charAt(i);
if (d >= 0x4e00 && d <= 0x9fa5)
{
xcount++;
}

if(i+1!=context.length())//优化
{
char dd=context.charAt(i+1);
if (dd >= 0x4e00 && dd <= 0x9fa5)
{
chargit=true;
}else
{
chargit=false;
}
}
if(xcount==msgLength-1&&chargit&&j<sum-1)
{
str[j]=context.substring(endchina,i+1);
endchina=i+1;
break;
}else if(xcount==msgLength&&j<sum-1)
{
str[j]=context.substring(endchina,i+1);
endchina=i+1;
break;
}else if(j==sum-1)
{
str[j]=context.substring(endchina);
break;
}
}
}

return str;
}


}
http://bbs.csdn.net/topics/380095884
http://www.iteye.com/topic/790024
http://illy.iteye.com/blog/926651
http://xiaoruanjian.iteye.com/blog/878930
http://ago520.iteye.com/blog/732021
http://www-zcl1024126430-gmail-com.iteye.com/blog/1396535
http://www.iteye.com/topic/975485
http://long316.iteye.com/blog/1072290
http://zhenjw.iteye.com/blog/173686
http://www.iteye.com/topic/218589
http://www.iteye.com/topic/567144
http://www.iteye.com/topic/127736
http://www.iteye.com/news/13683
http://shamu.iteye.com/blog/1054581
http://wangking717.iteye.com/blog/764307
http://www.iteye.com/news/25048
http://www.iteye.com/news/26494
http://www.iteye.com/topic/587879


http://www.iteye.com/topic/573456
http://pan.baidu.com/disk/home

http://code.google.com/p/wro4j/downloads/list?can=1&q=&colspec=Filename+Summary+Uploaded+ReleaseDate+Size+DownloadCount
强大的Mockito测试框架
http://blog.csdn.net/dc_726/article/details/8568537
完美解决多应用服务器负载均衡环境下spring quartz同一定时任务重复执行问题
http://medbricom.iteye.com/blog/1782765
Java Cache 开源项目
http://itmingong.iteye.com/blog/1356200
实践是检验真理的唯一标准——《精益创业实战》让你的成功飞起来
http://blog.csdn.net/liuzif/article/details/8568611
浅析count(1) count(*) count(col)的区别和性能
http://blog.csdn.net/linwaterbin/article/details/8569257
英语口语资料大全
http://blog.chinaunix.net/uid-25838286-id-3037874.html
Linux/Unix shell 监控Oracle告警日志(monitor alter log file)
http://blog.csdn.net/robinson_0612/article/details/8569759
JAVA缓存技术
http://blog.csdn.net/madun/article/details/8569860
男人城府的修练
http://blog.csdn.net/xielei2006happy/article/details/8567651

元创的日记
元创的主页 广播 相册 喜欢 二手 活动 发豆邮 用Visual C++编译python
2009-07-25 19:14:03
用Microsoft Visual C++ 2008 Express Edition编译python2.6.21. 下载Visual C++ 2008 Express Editionhttp://www.microsoft.com/express/download/#webInstall 2. 下载Python2.6.2http://www.python.org/download/releases/2.6.2/ 假设下载Gzipped source tar ball (2.6.2)并解压到的D:盘。3. 编译D:\>cd python-2.6.2D:\Python-2.6.2>cd pcbuildD:\Python-2.6.2\PCbuild>envBuild environments: x86, ia64, amd64, x86_amd64, x86_ia64Setting environment for using Microsoft Visual Studio 2008 x86 tools.D:\Python-2.6.2\PCbuild>buildvcbuild /useenv pcbuild.sln "Release|Win32"Microsoft (R) Visual C++ Project Builder - Command Line Version 9.00.30729Copyright (C) Microsoft Corporation. All rights reserved.Build started: Project: make_versioninfo, Configuration: Release|Win32…Build complete: 18 Projects succeeded, 7 Projects failed, 1 Projects skipped4. 结果D:\Python-2.6.2\PCbuild>pythonPython 2.6.2 (r262:71600, Jul 25 2009, 18:39:03) [MSC v.1500 32 bit (Intel)] onwin32Type "help", "copyright", "credits" or "license" for more information.>>> print "hello, visual c++"hello, visual c++>>>虽然有很多的内容编译不通过,但python.exe和python.dll都产生了,基本算成功了吧。
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值