随笔分类 -  代码仓库

实用代码整理和摘录
获得字符串长度(中文字符占2)
摘要:获得字符串长度(中文字符占2)1/**////<summary>2///字符串长度3///</summary>4///<param name="strStr"></param>5///<returns></returns>6privateintGetStringLength(stringstrStr)7{8Encoding e... 阅读全文

posted @ 2008-03-27 22:38 书生 阅读(617) 评论(0) 推荐(0)

读写xml节点的数据总结
摘要:读写xml节点的数据总结读: //打开某文件(假设web.config在根目录中)string filename=Server.MapPath("/") + @"WebApplication1web.config";XmlDocument xmldoc= new XmlDocument();xmldoc.Load(filename);//得到顶层节点列表XmlNodeList topM=xmldo... 阅读全文

posted @ 2007-05-28 15:02 书生 阅读(316) 评论(0) 推荐(0)

Asp.net(C#)实现验证码功能
摘要:ASP.net 验证码(C#) /**//* Copyright all(c) 2005 ZhongFeng, http://blog.csdn.net/SW515 */ public class ValidateCode : System.Web.UI.Page ...{ private void Page_Load(object sender, System.EventArgs e) .... 阅读全文

posted @ 2007-05-28 09:36 书生 阅读(334) 评论(0) 推荐(0)

自定义编码解析函数示例
摘要:酒店编码解析#region 酒店编码解析 /**//// /// 酒店编码解析.休闲设施 /// /// fallow,service,meal,creditCard,auditmeans,calculateMethod,hotelCategory,netservice,roomservice /// 休闲设施,服务设施,餐厅设施,信用卡... 阅读全文

posted @ 2007-05-26 22:37 书生 阅读(253) 评论(0) 推荐(0)

常用正则表达式,已封装为静态方法,
摘要:#region Regular Expression /**//// /// 校验字符串是否只包含字母与数字 /// /// 需要校验的字符串 /// true表示符合要求,false表示不符合要求 public static bool IsOnlyLetterAndDigit(string toVerifie... 阅读全文

posted @ 2007-05-26 22:32 书生 阅读(805) 评论(0) 推荐(0)

将自定义对象序列化为XML字符串
摘要:#region Serialize /**//// /// 将自定义对象序列化为XML字符串 /// /// 自定义对象实体 /// 序列化后的XML字符串 public static string SerializeToXml(object myClass) ...{ if... 阅读全文

posted @ 2007-05-26 22:30 书生 阅读(855) 评论(1) 推荐(0)

设置或者得到CheckBoxList选中了的值
摘要:#region 设置或者得到CheckBoxList选中了的值 /**//// /// 初始化CheckBoxList中哪些是选中了的 /// /// CheckBoxList /// 选中了的值串例如:"0,1,1,2,1" /// 值串中使用的分割符例如"0,1,1,2,1"中的逗号 pub... 阅读全文

posted @ 2007-05-26 22:21 书生 阅读(3368) 评论(0) 推荐(0)

字符串判断公共方法
摘要:/**//// /// 是否是数字型 /// /// /// public static bool IsNumeric(string value) ...{ return Regex.IsMatch(value, @"^[+-]?d*[.]?d*$"); } ... 阅读全文

posted @ 2007-05-26 22:17 书生 阅读(314) 评论(0) 推荐(0)

导航