[netMarketing类库] stringHelper类 :字符串处理辅助类

命名空间:netMarketing.dataType.stringHelper

功能:字符串处理辅助类


功能详细说明:


常用函数列表

/// 拆分十六进制串,按4位拆分,转为short
 public static List<short> hexStrToShortList(this string data)
/// 按字符数量拆分字符串
public static List<string> splitStrByNum(this string data,int num)
/// 取左右串之间的文本,取不到则返回空串
public static string getMidString(this string html, string leftString, string rightString)
/// 把字符串按指定字数换行重排
 public static string stringReturn(this string str,int returnLen)
 /// 过滤数字串中的非法字符,以便能顺利完成字符串转数值型
public static string filterNonNumerChar(string numstr)
/// 根据时间得到目录名yyyyMMdd
public static string GetDateDir()
/// 根据时间得到文件名HHmmssff
public static string GetDateFile()
/// 取年月日时分秒串
public static string GetMMYYDDHHMMSS()
/// 取年月日串
public static string GetMMYYDD()
/// 把字符串按照分隔符转换成 List
public static List<string> GetStrArray(this string str, char speater, bool toLower)
/// 把字符串转 按照, 分割 换为数据
public static string[] GetStrArray(this string str)
/// 把 List string 按照分隔符组装成 string
public static string GetArrayStr(this List<string> list, string speater)
/// 得到数组列表以逗号分隔的字符串
public static string GetArrayStr(this List<int> list)
/// 得到数组列表以逗号分隔的字符串
public static string GetArrayValueStr(Dictionary<int, int> list)
 /// 删除最后结尾的一个逗号
 public static string DelLastComma(this string str)
/// 删除最后结尾的指定字符后的字符
public static string DelLastChar(this string str, string strchar)
/// 转全角的函数(SBC case)
public static string ToSBC(this string input)
///  转半角的函数(SBC case)
public static string ToDBC(this string input)
/// 把字符串按照指定分隔符装成 List 去除重复
public static List<string> GetSubStringList(this string o_str, char sepeater)
///  将字符串样式转换为纯字符串
public static string GetCleanStyle(this string StrList, string SplitString)
/// 将字符串转换为新样式
public static string GetNewStyle(this string StrList, string NewStyle, string SplitString, out string Error)
/// 分割字符串
public static string[] SplitMulti(this string str, string splitstr)
/// 得到sql安全字符串
public static string SqlSafeString(this string String, bool IsDel)
/// 获取正确的Id,如果不是正整数,返回0
public static int StrToId(string _value)
/// 检查一个字符串是否是纯数字构成的,一般用于查询字符串参数的有效性验证。(0除外)
public static bool IsNumberId(string _value)
/// 快速验证一个字符串是否符合指定的正则表达式。
public static bool QuickValidate(string _express, string _value)
/// 根据配置对指定字符串进行 MD5 加密
public static string GetMD5(string s)
/// 得到字符串长度,一个汉字长度为2
public static int StrLength(string inputString)
/// 截取指定长度字符串
public static string ClipString(string inputString, int len)
/// HTML转行成TEXT
public static string HtmlToTxt(string strHtml)
/// 判断对象是否为空,为空返回true
public static bool IsNullOrEmpty<T>(T data)
/// 判断对象是否为空,为空返回true
public static bool IsNullOrEmpty(object data)
/// 取右串
public static string RightStr(this string data, int sum)
/// 取左串
public static string LeftStr(this string data, int sum)
/// 读磁盘文件内容,读不到返回空串
public static string loadStrFromDisk(string fileNamePath)
/// 保存字符串内容到磁盘
public static bool saveStrToDisk(this string data, string fileNamePath, bool isAppend = false, bool addNewLine = false)
/// 要求给定的参数不能是null
public static void NotNull(object parameter, string parameterName)
/// 要求给定的字符串不能是null或者是空
public static void NotNullOrEmpty(string parameter, string parameterName)
/// 要求给定的字符串不能是null、空字符串或者全是空白字符
public static void NotNullOrWhiteSpace(string parameter, string parameterName)
/// 要求满足特定的条件
public static void Satisfy(Func<bool> criteria, string parameterName, string message)
/// 取重复字符串
public static string RepeatStr(string repeatStr, int count)
/// 打开记事本显示ASCII表
public static void GetASCIItable()


--------------------- 

作者:hackpig
来源:www.skcircle.com
版权声明:本文为博主原创文章,转载请附上博文链接!

返回类库功能说明目录


本文出自勇哥的网站《少有人走的路》wwww.skcircle.com,转载请注明出处!讨论可扫码加群:

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

会员中心
搜索
«    2024年4月    »
1234567
891011121314
15161718192021
22232425262728
2930
网站分类
标签列表
最新留言
    热门文章 | 热评文章 | 随机文章
文章归档
友情链接
  • 订阅本站的 RSS 2.0 新闻聚合
  • 扫描加本站机器视觉QQ群,验证答案为:halcon勇哥的机器视觉
  • 点击查阅微信群二维码
  • 扫描加勇哥的非标自动化群,验证答案:C#/C++/VB勇哥的非标自动化群
  • 扫描加站长微信:站长微信:abc496103864
  • 扫描加站长QQ:
  • 扫描赞赏本站:
  • 留言板:

Powered By Z-BlogPHP 1.7.2

Copyright Your skcircle.com Rights Reserved.

鄂ICP备18008319号


站长QQ:496103864 微信:abc496103864