![](https://img-blog.csdnimg.cn/20201014180756780.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
C#
文章平均质量分 58
星海穿梭者
这个作者很懒,什么都没留下…
展开
-
本地日志建立文档LOG
using System; using System.IO; using System.Text; public static void Writelog(string msg) { StreamWriter stream; //写入日志内容 string path = AppDomain.CurrentDomain.BaseDirectory+"\\log\\" + DateTime.Now.ToInvariantStri...原创 2022-02-17 09:39:42 · 116 阅读 · 0 评论 -
c#电话效验正则表达式
public bool IsPhoneNo(string str_handset) { return Regex.IsMatch(str_handset, "^(0\\d{2,3}-?\\d{7,8}(-\\d{3,5}){0,1})|(((13[0-9])|(15([0-3]|[5-9]))|(18[0-9])|(17[0-9])|(14[0-9])|(19[0-9]))\\d{8})$"); } ...原创 2021-08-24 17:24:07 · 159 阅读 · 0 评论 -
2021-02-24
c#数据类型,类型转换,变量,常量,转义符 数据类型可以分为两大类:基本数据类型和引用类型。 基本数据类型按功能又分为“值类型”,“布尔型”,“字符型”。 引用类型分为“字符串”,“时间日期”。 橙色圈起来的是常用的类型 字符串类型 string 可以定义任意数据,几乎没有长度限制。赋值使必须带引号 string a =“”; string aa= null;只有字符串类型可以定义空值。 整形类型int只可以定义整数或者负整数。长度为10位数...原创 2021-02-24 15:51:24 · 61 阅读 · 0 评论 -
动态调用Webserver传xml参数
string[] args = new string[1]; StringBuilder xml = new StringBuilder(); xml.Append("<Request><MessageHeader><Sender>MNIS</Sender>"); xml.Append("<...原创 2019-11-07 15:09:35 · 418 阅读 · 0 评论 -
c#判断浮点类型
public static bool IsDecimalSign(string inputData) { Regex RegDecimalSign = new Regex("^[+-]?[0-9]+[.]?[0-9]+$"); Match m = RegDecimalSign.Match(inputData); ...原创 2019-01-03 16:17:49 · 1262 阅读 · 0 评论 -
c# 正则判断字符串是否数字
Regex regExp = new Regex(" ^[0 - 9] * $"); regExp.IsMatch(Character);原创 2018-08-07 08:19:47 · 5699 阅读 · 0 评论 -
c# 正则判断是否存在非法字符串
Regex regExp = new Regex("[ \\[ \\] \\^ \\-_*×――(^)$%~!@#$…&%¥—+=<>《》!!???::•`·、。,;,.;\"‘’“”-]"); regExp.IsMatch(Character);原创 2018-08-07 08:18:12 · 3980 阅读 · 0 评论 -
c# 存储过程的调用
try { Hashtable item = HttpContext.Current.Application["hbm"] as Hashtable; string sr = string.Concat(item["hibernate.connection.connection_waterString"]);...原创 2018-07-04 16:30:55 · 123 阅读 · 0 评论 -
NPOI导出生成Excel文档
using System; using System.Collections.Generic; using System.Text; using System.Data; using System.IO; using NPOI.SS.UserModel; using NPOI.HSSF.UserModel; /// /// 导出数据 ///原创 2018-01-10 19:12:08 · 217 阅读 · 0 评论 -
根据身份证算年龄
public static int GetAge(string idcard) { if (string.IsNullOrEmpty(idcard) || idcard.Length != 18) return 0; int x = Convert.ToInt32(idcard.Substrin原创 2017-12-08 17:05:42 · 206 阅读 · 0 评论 -
c#txt文件存到string数组中报错
string Text="C:\Users\Administrator\Desktop\MRN_list_2016-10-07.txt" string[] textfile = Directory.GetFiles(Text);//目录名称无效原创 2016-10-13 12:40:01 · 261 阅读 · 0 评论