字符串的判断

1.为空:   
string error=Request.QueryString["ReturnUrl"];
   if (error!=null)
   {
    LoginErr.Text="非法的外部链接访问,请重新登陆!!<p></p><font color='#aeaaa9'>@ 联系内线:8064 aipeli & victor<br>@ 支持站点:www.aipe.cn</font>";
    LoginErr.Visible=true;
   }
2.
  /// <summary>
  /// 按字节数取出字符串的长度
  /// </summary>
  /// <param name="strTmp">要计算的字符串</param>
  /// <returns>字符串的字节数</returns>
  public static int GetByteCount(string strTmp)
  {
   int intCharCount=0;
   for(int i=0;i<strTmp.Length;i++)
   {
    if(System.Text.UTF8Encoding.UTF8.GetByteCount(strTmp.Substring(i,1))==3)
    {
     intCharCount=intCharCount+2;
    }
    else
    {
     intCharCount=intCharCount+1;
    }
   }
   return intCharCount;
  }
posted @ 2006-08-30 14:58  泡面 @ 幸福  阅读(240)  评论(0)    收藏  举报