码迷,mamicode.com
首页 >  
搜索关键字:try    ( 12995个结果
python 得到一个元素的所有下标(网友提供:http://www.oschina.net/code/snippet_212212_38917)
defall_index(l,o):deffind_index(l,o,start=0):try:index=l.index(o,start)except:index=-1returnindexindexs=[]i=0whileTrue:idx=find_index(l,o,i)ifidx==-1:...
分类:编程语言   时间:2014-09-25 21:59:47    阅读次数:212
java判断一个字符串中是否含有中文
package src; public class Main { public static void main(String args[]){ String chinese = "中文 is english"; int clenth = 0; try{ clenth = chinese.getBytes("gbk").length; }catch(Exc...
分类:编程语言   时间:2014-09-25 18:35:57    阅读次数:230
byte与base64字串换转
public byte[] base64ToByte(String strBase64){ if(strBase64==null)return null; byte[] bytes = null; try { BASE64Decoder dec = ne...
分类:其他好文   时间:2014-09-25 14:04:28    阅读次数:205
java 连接jdbc部分
连接数据库步骤: a. 用java程序与db建立一个连接(通道) b。根据连接获取一个执行sql语句的对象 c。执行sql语句 d。关闭连接public class Main { public static void main(String[] args) { try { ...
分类:数据库   时间:2014-09-25 12:58:29    阅读次数:172
python打印详细的异常信息
1 #!/usr/bin/env python2 #coding=utf-83 import traceback 4 5 try:6 1/07 except Exception, e:8 print e9 print traceback.format_exc()
分类:编程语言   时间:2014-09-25 12:50:28    阅读次数:194
Java读取TXT文本
public String readTxtFile(String filePath) { StringBuffer appInfolistInput = new StringBuffer(); try { String encoding = "UTF8"; File file = new...
分类:编程语言   时间:2014-09-25 11:54:18    阅读次数:147
2014=9=24 连接数据库1
package cn.sql.sqlconn;public class Util { public Util(){ try { Class.forName("com.mysql.jdbc.Driver"); } catch (C...
分类:数据库   时间:2014-09-24 22:15:07    阅读次数:203
初学bbs分页
final int PAGE_SIZE = 4;int pageNo = 1;String strPageNo = request.getParameter("pageNo");if(strPageNo != null && !"".equals(strPageNo.trim())) { try ....
分类:其他好文   时间:2014-09-24 21:44:47    阅读次数:193
java 流读写文件
public static void createFileToNewPath(InputStream inStream, String newPath) { try { int bytesum = 0; int byteread = 0; ...
分类:编程语言   时间:2014-09-24 19:30:27    阅读次数:167
Winfrom巧用Using设置鼠标为WaitCursor
本文转载:http://www.cnblogs.com/LoveJenny/archive/2013/03/13/2956922.html看到try,finally ,有没有让你想到什么呢?,对了using 可以生成try-finallypublic class WaitCursor : IDisp...
分类:Windows程序   时间:2014-09-24 15:36:27    阅读次数:240
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!