易截截图软件、单文件、免安装、纯绿色、仅160KB

[转]asp.net区分中英文字符串截取

/// <summary>
/// 字符串切割
/// </summary>
/// <param name="p_SrcString"></param>
/// <param name="p_Length"></param>
/// <returns></returns>
public static string GetSubString(string p_SrcString, int p_Length)
{
string myResult = p_SrcString;
if (p_Length >= 0)
{
byte[] bsSrcString = System.Text.Encoding.GetEncoding("GB2312").GetBytes(p_SrcString);
if (bsSrcString.Length >= p_Length)
{
int nRealLength = p_Length;
int[] anResultFlag = new int[p_Length];
byte[] bsResult = null;
int nFlag = 0;
for (int i = 0; i < p_Length; i++)
{
if (bsSrcString[i] > 127)
{
nFlag++;
if (nFlag == 3)
nFlag = 1;
}
else
nFlag = 0;
anResultFlag[i] = nFlag;
}
if ((bsSrcString[p_Length - 1] > 127) && (anResultFlag[p_Length - 1] == 1))
nRealLength = p_Length + 1;
bsResult = new byte[nRealLength];
Array.Copy(bsSrcString, bsResult, nRealLength);
myResult = System.Text.Encoding.GetEncoding("GB2312").GetString(bsResult) + "...";
}
}
return myResult;
}


相关文档:

asp.net常用代碼


1.弹出对话框.
  a. 弹出对话框:
 
C# codeClientScript.RegisterStartupScript(this.GetType(), "",
"<script>window.alert('该会员没有提交申请,请重新提交!')</script>");
  b.转向指定页面
 
C# code Response.Write("
<script>window.location='http://www. ......

MySQL(asp.net) 事务

 try
        {
            string _conStr = "Driver={MySQL ODBC 3.51
Driver};server=localhost;database=test;uid=test;password=1;option=3";
          & ......

ASP.NET实现自适应图片大小的弹出窗口

ASP.NET实现自适应图片大小的弹出窗口
在最近的项目中,遇到一个问题,要实现这样的效果:
点pic_small.Aspx页面的缩略图后弹出pic_all.aspx页面,pic_all.aspx页面的大小要根据图片大小自动调整,而且要有图片的说明信息,还可以点上一幅和下一幅等进行翻页。
实现过程如下:
pic_small.Aspx页面缩略图处的代码为: ......

ASP.NET页面刷新方法总结

第一:
private void Button1_Click( object sender, System.EventArgs e ) { Response.Redirect( Request.Url.ToString( ) ); } 第二:
private void Button2_Click( object sender, System.EventArgs e ) { Response.Write( " < script language=javascript>window.location.href=document.URL; < /script&g ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号