- 浏览: 246551 次
- 性别:
- 来自: 济南
文章分类
- 全部博客 (205)
- jQuery (27)
- Flash AS3.0 (0)
- Html5+CSS3 (12)
- C# .Net (19)
- Xml XPath XSLT (5)
- Sql (3)
- JavaScript (20)
- struts2 (23)
- hibernate (24)
- spring (11)
- j2ee (16)
- jsp/java (11)
- 设计模式 (5)
- json (3)
- Java.IO (7)
- Java.Util (7)
- android (8)
- WebService (10)
- MyEclipse SVN (3)
- servlet (1)
- Exception (3)
- 自我学习 (2)
- UML (2)
- java泛型 (1)
- Lucene (7)
- HtmlParser (2)
- 概念理解 (3)
- 正则表达式 (1)
- EMail (1)
最新评论
-
hanmiao:
没用,干巴巴的壹堆代码,没明白到底区别在哪里。
List Set Map 区别! -
e421083458:
偶来过了!
C#单向链表的实现
using System;
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Configuration;
using System.Web;
namespace DtCms.Common
{
public class Utils
{
#region 将字符串转换为数组
public static string[] GetStrArray(string str)
{
return str.Split(new char[',']);
}
#endregion
#region 将数组转换为字符串
public static string GetArrayStr(List<string> list, string speater)
{
StringBuilder sb = new StringBuilder();
for (int i = 0; i < list.Count; i++)
{
if (i == list.Count - 1)
{
sb.Append(list[i]);
}
else
{
sb.Append(list[i]);
sb.Append(speater);
}
}
return sb.ToString();
}
#endregion
#region 删除最后结尾的一个逗号
/// <summary>
/// 删除最后结尾的一个逗号
/// </summary>
public static string DelLastComma(string str)
{
return str.Substring(0, str.LastIndexOf(","));
}
#endregion
#region 删除最后结尾的指定字符后的字符
/// <summary>
/// 删除最后结尾的指定字符后的字符
/// </summary>
public static string DelLastChar(string str, string strchar)
{
return str.Substring(0, str.LastIndexOf(strchar));
}
#endregion
#region 生成指定长度的字符串
/// <summary>
/// 生成指定长度的字符串,即生成strLong个str字符串
/// </summary>
/// <param name="strLong">生成的长度</param>
/// <param name="str">以str生成字符串</param>
/// <returns></returns>
public static string StringOfChar(int strLong, string str)
{
string ReturnStr = "";
for (int i = 0; i < strLong; i++)
{
ReturnStr += str;
}
return ReturnStr;
}
#endregion
#region 生成日期随机码
/// <summary>
/// 生成日期随机码
/// </summary>
/// <returns></returns>
public static string GetRamCode()
{
#region
return DateTime.Now.ToString("yyyyMMddHHmmssffff");
#endregion
}
#endregion
#region 截取字符长度
/// <summary>
/// 截取字符长度
/// </summary>
/// <param name="inputString">字符</param>
/// <param name="len">长度</param>
/// <returns></returns>
public static string CutString(string inputString, int len)
{
ASCIIEncoding ascii = new ASCIIEncoding();
int tempLen = 0;
string tempString = "";
byte[] s = ascii.GetBytes(inputString);
for (int i = 0; i < s.Length; i++)
{
if ((int)s[i] == 63)
{
tempLen += 2;
}
else
{
tempLen += 1;
}
try
{
tempString += inputString.Substring(i, 1);
}
catch
{
break;
}
if (tempLen > len)
break;
}
//如果截过则加上半个省略号
byte[] mybyte = System.Text.Encoding.Default.GetBytes(inputString);
if (mybyte.Length > len)
tempString += "…";
return tempString;
}
#endregion
#region 清除HTML标记
public static string DropHTML(string Htmlstring)
{
//删除脚本
Htmlstring = Regex.Replace(Htmlstring, @"<script[^>]*?>.*?</script>", "", RegexOptions.IgnoreCase);
//删除HTML
Htmlstring = Regex.Replace(Htmlstring, @"<(.[^>]*)>", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"([\r\n])[\s]+", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"-->", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"<!--.*", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(quot|#34);", "\"", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(amp|#38);", "&", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(lt|#60);", "<", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(gt|#62);", ">", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(nbsp|#160);", " ", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(iexcl|#161);", "\xa1", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(cent|#162);", "\xa2", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(pound|#163);", "\xa3", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(copy|#169);", "\xa9", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&#(\d+);", "", RegexOptions.IgnoreCase);
Htmlstring.Replace("<", "");
Htmlstring.Replace(">", "");
Htmlstring.Replace("\r\n", "");
Htmlstring = HttpContext.Current.Server.HtmlEncode(Htmlstring).Trim();
return Htmlstring;
}
#endregion
#region 清除HTML标记且返回相应的长度
public static string DropHTML(string Htmlstring, int strLen)
{
return CutString(DropHTML(Htmlstring), strLen);
}
#endregion
#region TXT代码转换成HTML格式
/// <summary>
/// 字符串字符处理
/// </summary>
/// <param name="chr">等待处理的字符串</param>
/// <returns>处理后的字符串</returns>
/// //把TXT代码转换成HTML格式
public static String ToHtml(string Input)
{
StringBuilder sb = new StringBuilder(Input);
sb.Replace("&", "&");
sb.Replace("<", "<");
sb.Replace(">", ">");
sb.Replace("\r\n", "<br />");
sb.Replace("\n", "<br />");
sb.Replace("\t", " ");
//sb.Replace(" ", " ");
return sb.ToString();
}
#endregion
#region HTML代码转换成TXT格式
/// <summary>
/// 字符串字符处理
/// </summary>
/// <param name="chr">等待处理的字符串</param>
/// <returns>处理后的字符串</returns>
/// //把HTML代码转换成TXT格式
public static String ToTxt(String Input)
{
StringBuilder sb = new StringBuilder(Input);
sb.Replace(" ", " ");
sb.Replace("<br>", "\r\n");
sb.Replace("<br>", "\n");
sb.Replace("<br />", "\n");
sb.Replace("<br />", "\r\n");
sb.Replace("<", "<");
sb.Replace(">", ">");
sb.Replace("&", "&");
return sb.ToString();
}
#endregion
#region 检查危险字符
/// <summary>
/// 检查危险字符
/// </summary>
/// <param name="Input"></param>
/// <returns></returns>
public static string Filter(string sInput)
{
if (sInput == null || sInput == "")
return null;
string sInput1 = sInput.ToLower();
string output = sInput;
string pattern = @"*|and|exec|insert|select|delete|update|count|master|truncate|declare|char(|mid(|chr(|'";
if (Regex.Match(sInput1, Regex.Escape(pattern), RegexOptions.Compiled | RegexOptions.IgnoreCase).Success)
{
throw new Exception("字符串中含有非法字符!");
}
else
{
output = output.Replace("'", "''");
}
return output;
}
#endregion
#region 检查过滤设定的危险字符
/// <summary>
/// 检查过滤设定的危险字符
/// </summary>
/// <param name="InText">要过滤的字符串 </param>
/// <returns>如果参数存在不安全字符,则返回true </returns>
public static bool SqlFilter(string word, string InText)
{
if (InText == null)
return false;
foreach (string i in word.Split('|'))
{
if ((InText.ToLower().IndexOf(i + " ") > -1) || (InText.ToLower().IndexOf(" " + i) > -1))
{
return true;
}
}
return false;
}
#endregion
#region 过滤特殊字符
/// <summary>
/// 过滤特殊字符
/// </summary>
/// <param name="Input"></param>
/// <returns></returns>
public static string Htmls(string Input)
{
if (Input != string.Empty && Input != null)
{
string ihtml = Input.ToLower();
ihtml = ihtml.Replace("<script", "<script");
ihtml = ihtml.Replace("script>", "script>");
ihtml = ihtml.Replace("<%", "<%");
ihtml = ihtml.Replace("%>", "%>");
ihtml = ihtml.Replace("<$", "<$");
ihtml = ihtml.Replace("$>", "$>");
return ihtml;
}
else
{
return string.Empty;
}
}
#endregion
#region 获得配置文件节点XML文件的绝对路径
public static string GetXmlMapPath(string xmlName)
{
return GetMapPath(ConfigurationManager.AppSettings[xmlName].ToString());
}
#endregion
#region 获得当前绝对路径
/// <summary>
/// 获得当前绝对路径
/// </summary>
/// <param name="strPath">指定的路径</param>
/// <returns>绝对路径</returns>
public static string GetMapPath(string strPath)
{
if (strPath.ToLower().StartsWith("http://"))
{
return strPath;
}
if (HttpContext.Current != null)
{
return HttpContext.Current.Server.MapPath(strPath);
}
else //非web程序引用
{
strPath = strPath.Replace("/", "\\");
if (strPath.StartsWith("\\"))
{
strPath = strPath.Substring(strPath.IndexOf('\\', 1)).TrimStart('\\');
}
return System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, strPath);
}
}
#endregion
/// <summary>
/// 写cookie值
/// </summary>
/// <param name="strName">名称</param>
/// <param name="strValue">值</param>
public static void WriteCookie(string strName, string strValue)
{
HttpCookie cookie = HttpContext.Current.Request.Cookies[strName];
if (cookie == null)
{
cookie = new HttpCookie(strName);
}
cookie.Value = strValue;
HttpContext.Current.Response.AppendCookie(cookie);
}
/// <summary>
/// 写cookie值
/// </summary>
/// <param name="strName">名称</param>
/// <param name="strValue">值</param>
public static void WriteCookie(string strName, string key, string strValue)
{
HttpCookie cookie = HttpContext.Current.Request.Cookies[strName];
if (cookie == null)
{
cookie = new HttpCookie(strName);
}
cookie[key] = strValue;
HttpContext.Current.Response.AppendCookie(cookie);
}
/// <summary>
/// 写cookie值
/// </summary>
/// <param name="strName">名称</param>
/// <param name="strValue">值</param>
/// <param name="strValue">过期时间(分钟)</param>
public static void WriteCookie(string strName, string strValue, int expires)
{
HttpCookie cookie = HttpContext.Current.Request.Cookies[strName];
if (cookie == null)
{
cookie = new HttpCookie(strName);
}
cookie.Value = strValue;
cookie.Expires = DateTime.Now.AddMinutes(expires);
HttpContext.Current.Response.AppendCookie(cookie);
}
/// <summary>
/// 读cookie值
/// </summary>
/// <param name="strName">名称</param>
/// <returns>cookie值</returns>
public static string GetCookie(string strName)
{
if (HttpContext.Current.Request.Cookies != null && HttpContext.Current.Request.Cookies[strName] != null)
return HttpContext.Current.Request.Cookies[strName].Value.ToString();
return "";
}
/// <summary>
/// 读cookie值
/// </summary>
/// <param name="strName">名称</param>
/// <returns>cookie值</returns>
public static string GetCookie(string strName, string key)
{
if (HttpContext.Current.Request.Cookies != null && HttpContext.Current.Request.Cookies[strName] != null && HttpContext.Current.Request.Cookies[strName][key] != null)
return HttpContext.Current.Request.Cookies[strName][key].ToString();
return "";
}
}
}
using System.Collections.Generic;
using System.Text;
using System.Text.RegularExpressions;
using System.Configuration;
using System.Web;
namespace DtCms.Common
{
public class Utils
{
#region 将字符串转换为数组
public static string[] GetStrArray(string str)
{
return str.Split(new char[',']);
}
#endregion
#region 将数组转换为字符串
public static string GetArrayStr(List<string> list, string speater)
{
StringBuilder sb = new StringBuilder();
for (int i = 0; i < list.Count; i++)
{
if (i == list.Count - 1)
{
sb.Append(list[i]);
}
else
{
sb.Append(list[i]);
sb.Append(speater);
}
}
return sb.ToString();
}
#endregion
#region 删除最后结尾的一个逗号
/// <summary>
/// 删除最后结尾的一个逗号
/// </summary>
public static string DelLastComma(string str)
{
return str.Substring(0, str.LastIndexOf(","));
}
#endregion
#region 删除最后结尾的指定字符后的字符
/// <summary>
/// 删除最后结尾的指定字符后的字符
/// </summary>
public static string DelLastChar(string str, string strchar)
{
return str.Substring(0, str.LastIndexOf(strchar));
}
#endregion
#region 生成指定长度的字符串
/// <summary>
/// 生成指定长度的字符串,即生成strLong个str字符串
/// </summary>
/// <param name="strLong">生成的长度</param>
/// <param name="str">以str生成字符串</param>
/// <returns></returns>
public static string StringOfChar(int strLong, string str)
{
string ReturnStr = "";
for (int i = 0; i < strLong; i++)
{
ReturnStr += str;
}
return ReturnStr;
}
#endregion
#region 生成日期随机码
/// <summary>
/// 生成日期随机码
/// </summary>
/// <returns></returns>
public static string GetRamCode()
{
#region
return DateTime.Now.ToString("yyyyMMddHHmmssffff");
#endregion
}
#endregion
#region 截取字符长度
/// <summary>
/// 截取字符长度
/// </summary>
/// <param name="inputString">字符</param>
/// <param name="len">长度</param>
/// <returns></returns>
public static string CutString(string inputString, int len)
{
ASCIIEncoding ascii = new ASCIIEncoding();
int tempLen = 0;
string tempString = "";
byte[] s = ascii.GetBytes(inputString);
for (int i = 0; i < s.Length; i++)
{
if ((int)s[i] == 63)
{
tempLen += 2;
}
else
{
tempLen += 1;
}
try
{
tempString += inputString.Substring(i, 1);
}
catch
{
break;
}
if (tempLen > len)
break;
}
//如果截过则加上半个省略号
byte[] mybyte = System.Text.Encoding.Default.GetBytes(inputString);
if (mybyte.Length > len)
tempString += "…";
return tempString;
}
#endregion
#region 清除HTML标记
public static string DropHTML(string Htmlstring)
{
//删除脚本
Htmlstring = Regex.Replace(Htmlstring, @"<script[^>]*?>.*?</script>", "", RegexOptions.IgnoreCase);
//删除HTML
Htmlstring = Regex.Replace(Htmlstring, @"<(.[^>]*)>", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"([\r\n])[\s]+", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"-->", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"<!--.*", "", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(quot|#34);", "\"", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(amp|#38);", "&", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(lt|#60);", "<", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(gt|#62);", ">", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(nbsp|#160);", " ", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(iexcl|#161);", "\xa1", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(cent|#162);", "\xa2", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(pound|#163);", "\xa3", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&(copy|#169);", "\xa9", RegexOptions.IgnoreCase);
Htmlstring = Regex.Replace(Htmlstring, @"&#(\d+);", "", RegexOptions.IgnoreCase);
Htmlstring.Replace("<", "");
Htmlstring.Replace(">", "");
Htmlstring.Replace("\r\n", "");
Htmlstring = HttpContext.Current.Server.HtmlEncode(Htmlstring).Trim();
return Htmlstring;
}
#endregion
#region 清除HTML标记且返回相应的长度
public static string DropHTML(string Htmlstring, int strLen)
{
return CutString(DropHTML(Htmlstring), strLen);
}
#endregion
#region TXT代码转换成HTML格式
/// <summary>
/// 字符串字符处理
/// </summary>
/// <param name="chr">等待处理的字符串</param>
/// <returns>处理后的字符串</returns>
/// //把TXT代码转换成HTML格式
public static String ToHtml(string Input)
{
StringBuilder sb = new StringBuilder(Input);
sb.Replace("&", "&");
sb.Replace("<", "<");
sb.Replace(">", ">");
sb.Replace("\r\n", "<br />");
sb.Replace("\n", "<br />");
sb.Replace("\t", " ");
//sb.Replace(" ", " ");
return sb.ToString();
}
#endregion
#region HTML代码转换成TXT格式
/// <summary>
/// 字符串字符处理
/// </summary>
/// <param name="chr">等待处理的字符串</param>
/// <returns>处理后的字符串</returns>
/// //把HTML代码转换成TXT格式
public static String ToTxt(String Input)
{
StringBuilder sb = new StringBuilder(Input);
sb.Replace(" ", " ");
sb.Replace("<br>", "\r\n");
sb.Replace("<br>", "\n");
sb.Replace("<br />", "\n");
sb.Replace("<br />", "\r\n");
sb.Replace("<", "<");
sb.Replace(">", ">");
sb.Replace("&", "&");
return sb.ToString();
}
#endregion
#region 检查危险字符
/// <summary>
/// 检查危险字符
/// </summary>
/// <param name="Input"></param>
/// <returns></returns>
public static string Filter(string sInput)
{
if (sInput == null || sInput == "")
return null;
string sInput1 = sInput.ToLower();
string output = sInput;
string pattern = @"*|and|exec|insert|select|delete|update|count|master|truncate|declare|char(|mid(|chr(|'";
if (Regex.Match(sInput1, Regex.Escape(pattern), RegexOptions.Compiled | RegexOptions.IgnoreCase).Success)
{
throw new Exception("字符串中含有非法字符!");
}
else
{
output = output.Replace("'", "''");
}
return output;
}
#endregion
#region 检查过滤设定的危险字符
/// <summary>
/// 检查过滤设定的危险字符
/// </summary>
/// <param name="InText">要过滤的字符串 </param>
/// <returns>如果参数存在不安全字符,则返回true </returns>
public static bool SqlFilter(string word, string InText)
{
if (InText == null)
return false;
foreach (string i in word.Split('|'))
{
if ((InText.ToLower().IndexOf(i + " ") > -1) || (InText.ToLower().IndexOf(" " + i) > -1))
{
return true;
}
}
return false;
}
#endregion
#region 过滤特殊字符
/// <summary>
/// 过滤特殊字符
/// </summary>
/// <param name="Input"></param>
/// <returns></returns>
public static string Htmls(string Input)
{
if (Input != string.Empty && Input != null)
{
string ihtml = Input.ToLower();
ihtml = ihtml.Replace("<script", "<script");
ihtml = ihtml.Replace("script>", "script>");
ihtml = ihtml.Replace("<%", "<%");
ihtml = ihtml.Replace("%>", "%>");
ihtml = ihtml.Replace("<$", "<$");
ihtml = ihtml.Replace("$>", "$>");
return ihtml;
}
else
{
return string.Empty;
}
}
#endregion
#region 获得配置文件节点XML文件的绝对路径
public static string GetXmlMapPath(string xmlName)
{
return GetMapPath(ConfigurationManager.AppSettings[xmlName].ToString());
}
#endregion
#region 获得当前绝对路径
/// <summary>
/// 获得当前绝对路径
/// </summary>
/// <param name="strPath">指定的路径</param>
/// <returns>绝对路径</returns>
public static string GetMapPath(string strPath)
{
if (strPath.ToLower().StartsWith("http://"))
{
return strPath;
}
if (HttpContext.Current != null)
{
return HttpContext.Current.Server.MapPath(strPath);
}
else //非web程序引用
{
strPath = strPath.Replace("/", "\\");
if (strPath.StartsWith("\\"))
{
strPath = strPath.Substring(strPath.IndexOf('\\', 1)).TrimStart('\\');
}
return System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, strPath);
}
}
#endregion
/// <summary>
/// 写cookie值
/// </summary>
/// <param name="strName">名称</param>
/// <param name="strValue">值</param>
public static void WriteCookie(string strName, string strValue)
{
HttpCookie cookie = HttpContext.Current.Request.Cookies[strName];
if (cookie == null)
{
cookie = new HttpCookie(strName);
}
cookie.Value = strValue;
HttpContext.Current.Response.AppendCookie(cookie);
}
/// <summary>
/// 写cookie值
/// </summary>
/// <param name="strName">名称</param>
/// <param name="strValue">值</param>
public static void WriteCookie(string strName, string key, string strValue)
{
HttpCookie cookie = HttpContext.Current.Request.Cookies[strName];
if (cookie == null)
{
cookie = new HttpCookie(strName);
}
cookie[key] = strValue;
HttpContext.Current.Response.AppendCookie(cookie);
}
/// <summary>
/// 写cookie值
/// </summary>
/// <param name="strName">名称</param>
/// <param name="strValue">值</param>
/// <param name="strValue">过期时间(分钟)</param>
public static void WriteCookie(string strName, string strValue, int expires)
{
HttpCookie cookie = HttpContext.Current.Request.Cookies[strName];
if (cookie == null)
{
cookie = new HttpCookie(strName);
}
cookie.Value = strValue;
cookie.Expires = DateTime.Now.AddMinutes(expires);
HttpContext.Current.Response.AppendCookie(cookie);
}
/// <summary>
/// 读cookie值
/// </summary>
/// <param name="strName">名称</param>
/// <returns>cookie值</returns>
public static string GetCookie(string strName)
{
if (HttpContext.Current.Request.Cookies != null && HttpContext.Current.Request.Cookies[strName] != null)
return HttpContext.Current.Request.Cookies[strName].Value.ToString();
return "";
}
/// <summary>
/// 读cookie值
/// </summary>
/// <param name="strName">名称</param>
/// <returns>cookie值</returns>
public static string GetCookie(string strName, string key)
{
if (HttpContext.Current.Request.Cookies != null && HttpContext.Current.Request.Cookies[strName] != null && HttpContext.Current.Request.Cookies[strName][key] != null)
return HttpContext.Current.Request.Cookies[strName][key].ToString();
return "";
}
}
}
发表评论
文章已被作者锁定,不允许评论。
-
经典.net面试题目
2011-08-09 14:14 7311. 简述 private、 protected、 publi ... -
.net面试问答(大汇总)
2011-08-09 13:57 1053用.net做B/S结构的系统, ... -
C#实现双向链表
2011-07-20 16:46 953/// <summary> /// 双向链 ... -
C#单向链表的实现
2011-07-20 16:39 1401public class UserTbl { priv ... -
js在线编辑器其中一个上传图片功能
2011-07-13 22:04 1300img.html <script language=&q ... -
Asp.net 中如何调用母版中的变量和变量
2011-07-07 11:27 2622((test)this.master).str: test:当 ... -
C# 循环DataSet表里的数据
2011-07-05 22:22 1929cs:DataSet ds = DbSqlClient.Que ... -
C#jQuery解决传值时获取的代码问题
2011-07-05 11:34 1083传值:escape($("input[name=co ... -
C# 生成 添加 修改 删除 XML节点操作
2011-07-04 20:56 2486XmlDocument xmldoc; Xml ... -
C# 正则表达式语法定义
2011-07-04 14:02 866Regex reg = new Regex("-&q ... -
C#修饰符
2011-06-17 13:29 7951, 访问修饰符 指定声 ... -
asp.net性能优化的几个方面
2011-06-17 09:48 888c#(或vb.net)程序改进 ... -
StringJoiner 拯救那些性能低下的字符串拼装代码
2011-06-17 09:44 1014作者:Bruce(编程的艺 ... -
HttpModule
2011-06-17 09:04 878HttpModule & HttpHandle TE& ... -
C# CS 语法
2011-06-16 14:13 856C#Md5加密16位的: System.W ... -
ASP.NET页面与IIS底层交互和工作原理详解 (二)
2011-06-15 16:12 857第三回: 引言 Http 请求 ... -
ASP.NET页面与IIS底层交互和工作原理详解(一)
2011-06-15 16:10 1057第一回: 引言 我查阅 ... -
Web.config的配置级原理
2011-06-15 15:50 798标签解释: configuration配置 Appsettin ...
相关推荐
只是个java源文件 方便大家工作使用 个人感觉写的还一般 奉献给大家 谢谢 包含了 字符串的常规处理的 类型转换等方法
本篇将详细讲解如何判断一个`NSString`对象是否为空,以及相关的字符串处理技巧。 首先,我们要理解"空"字符串的概念。在`NSString`中,"空"可以指以下几种情况: 1. **空字符串(Empty String)**: 字符串长度为0...
1. **字符串处理Utils**: - `StringUtils`:提供了一系列用于处理字符串的方法,如检查空值、拼接、分割、格式化等。 - `TextUtils`:是Android SDK中的一个类,提供了许多与字符串操作相关的实用方法,如`...
1. **字符串处理Utils**: - `trim()`:去除字符串两端的空白字符。 - `isEmpty()`:检查字符串是否为空或仅包含空白字符。 - `contains()`:检查字符串是否包含特定子串。 - `substring()`:提取字符串的一部分...
在Python编程语言中,字符串压缩是一个常见的操作,特别是在处理大量文本数据时,为了节省存储空间,我们会使用压缩算法。本节我们将深入探讨Python中的字符串压缩技术,并以标题"Python123之字符串压缩#134865"为...
本文将详细介绍如何在微信小程序中将字符串信息生成二维码图片的操作方法。 首先,介绍下什么是二维码。二维码(2-dimensional bar code),是由许多黑白相间的方块组成的矩形图案,通过黑白图案的不同组合编码信息...
using Falls27.Utils; MyString ms=new MyString(); //初始化 Console.WriteLine(ms.IndexOf("hello world","l",5)); //输出9 Console.WriteLine(ms.Substring("hello world",1,6)); //输出“ello w" Console....
二、字符串处理 Lang Utils中的StringUtils类是处理字符串的主力,提供了大量的静态方法。例如,`isEmpty()`用于检查字符串是否为空,`join()`用于将数组或集合元素拼接成字符串,`substringBetween()`用于提取字符...
Utils类库一般包含一系列静态方法,这些方法服务于不同的目的,如字符串处理、日期时间操作、文件I/O、网络通信、数学计算等。它们提供了方便的API,使开发者能快速执行常见的任务,而无需每次都需要创建新的对象。 ...
using Falls27.Utils; MyString ms=new MyString(); //初始化 Console.WriteLine(ms.IndexOf("hello world","l",5)); //输出9 Console.WriteLine(ms.Substring("hello world",1,6)); //输出“ello w" Console....
在这个名为"js_utils-master"的压缩包中,我们可以期待找到一系列封装好的JavaScript工具函数,它们涵盖了URL参数处理、数字与字符串操作以及日期相关的功能。 首先,让我们深入探讨URL参数处理。在Web开发中,我们...
* 正则统计字符串出现次数 * * @param source * @param regexNew * @return int */ public static int finder(String source, String regexNew) { String regex = "[a-zA-Z]+"; if (regexNew != ...
2.0.4版包含了众多实用工具类,例如文件操作、字符串处理、反射和类型转换等。其中,文件操作类提供了方便的方法来读写文件、检查文件是否存在、创建目录等。字符串处理类则包括了对字符串的格式化、分割、比较等...
Java字符串加密使用到的一个jar包 commons-lang3-3.1.jar下载 jar包含具体的类有 org.apache.commons.lang3.StringUtils org.apache.commons.lang3.ArrayUtils.class org.apache.commons.lang3.BitField.class org....
`js string utils` 是一个专注于提供字符串处理功能的工具库,它包含了一系列实用的函数,帮助开发者更高效地处理字符串数据。这个工具库的源码可以在博文中找到,链接为:https://ztc.iteye.com/blog/145821。 在`...
在这个"javautils"压缩包中,我们可以预见到包含了一些自定义的Java工具类,可能涵盖了字符串处理、日期时间操作、集合操作等多个方面。 1. **字符串处理**: JavaUtils中的字符串工具类可能会包含一些扩展了Java...
"java utils 工具类"这个主题主要关注Java中那些方便的工具类,特别是关于字符串处理的`StringUtil`。下面我们将深入探讨`StringUtil`类中的相关知识点。 首先,`StringUtil`通常是非官方的命名,因为它并未在Java...
在现代Web开发中,"Utils 最小字符"这个概念可能是指在处理字符串或文本时,对字符数量的限制。在给定的上下文中,我们可能会遇到一个需求,即需要限制某些元素(如URL、标签、按钮文本等)的字符长度,以确保页面的...
2. **StringUtil.java**:字符串处理是Java开发中常见的任务,此类提供了诸如检查空字符串、连接字符串、去除两端空白字符、格式化字符串、替换子串等方法。例如,`isEmpty()`用于判断字符串是否为空,`replace...