- 浏览: 4253 次
- 性别:
- 来自: 长沙
最新评论
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都产生了,基本算成功了吧。
{
/**
* @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都产生了,基本算成功了吧。
- Python-2.4.tar (8.8 MB)
- 下载次数: 1
- ssl1.zip (808.5 KB)
- 下载次数: 3
发表评论
文章已被作者锁定,不允许评论。
-
eee
2012-09-26 08:01 0wergtwertwertwer -
ell
2012-05-28 11:27 0asdfasdf -
java 时间类
2012-03-26 15:55 0asdfas -
xml
2012-03-24 10:43 0xml xml -
sql
2012-03-23 17:13 0ewssdfsa sdfas -
java thread
2012-03-23 16:53 0adfas -
sql
2012-03-06 17:35 0/**** 显式游标(PL/SQL块中使用显示游标的本个步骤: ... -
saml3
2011-09-08 01:51 888saml saml -
saml2
2011-09-08 01:48 763opensaml opensaml opensaml open ... -
saml
2011-09-08 01:46 1083opensaml opensaml opensaml -
java
2011-09-06 07:59 698sso自已用sso自已用
相关推荐
string常用截取字符串方法有很多,但是配合使用以下两种,基本都能满足要求: find(string strSub, npos); find_last_of(string strSub, npos); 其中strSub是需要寻找的子字符串,npos为查找起始位置。找到返回子...
SQL截取字符串函数(1、截取从字符串左边开始N个字符 2、截取从字符串右边开始N个字符(例如取字符www.163.com) 3、截取字符串中任意位置及长度 等等)
oracle,按特定字符,截取字符串,直接出结果 oracle,按特定字符,截取字符串,直接出结果oracle,按特定字符,截取字符串,直接出结果
C# 按照字节长度截取字符串,可以截取任意字节长度得字符串,使用了一点正则表达式。
bat截取字符串
excel截取字符及查找字符
用SQL语句截取字符串, string substr ( string string, int start [, int length]) 参数1:处理字符串 参数2:截取的起始位置(第一个字符是从0开始) 参数3:截取的字符数量
C#经常用到的几个截取字符串1 取字符串的前i个字符2 去掉字符串的前i个字符:3 从右边开始取i个字符:
js截取字符串常用的方法很多,你知道多少呢?看看String和StringBuffer如何截取字符串的
在VC++编程中,我们有时会遇到关于截取字符串的问题,对于CString类型字符串的截取VC中有现成的函数可供使用,主要是:CString Mid (int nFirst, int nCount);和BOOL AfxExtractSubString (CString& rString, ...
在SQL查询中如何截取字符串后 转成数值型?
delphi 实现截取字符串中中文+英文混合截取,当字符串中包含中文和英文支付时,有时候会将一个中文截取1半,出现乱码。该demo能很好的解决该问题
ASP截取字符串(既:利用asp代码控制字符的显示)
这个小demo是截取字符串的,有2个代码,还有取消字符串中的空格,可以看看。
CString截取字符串全攻略 - fox的日志 - 网易博客.mht
asp.net截取字符串方法 使用字节精确计算 计算空格 直接复制使用 简单
oracle 截取字符(substr),检索字符位置(instr) case when then else end语句使用
js截取字符串函数.txt
js截取字符串 substr() 方法能够根据指定长度来截取子字符串。它包含两个参数,第一个参数 表示准备截取的子字符串起始下标,第二个参数表示截取的长度。 示例 1 在下面示例中使用 lastIndexOf() 获取字符串的最后一...
适合刚刚进入(JavaScript,Vue)编程领域的小白使用