asp.net 中获取中文首字母的代码 亲测
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Text.RegularExpressions;
using System.Text;
public partial class baikeWeb_test : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
}
}
static public string GetChineseSpell(string strText)
{
int len = strText.Length;
string myStr = "";
for (int i = 0; i < len; i++)
{
myStr += getSpell(strText.Substring(i, 1).ToUpper());
}
//可以返回所有的中文字符的首字母
//return myStr;
return getSpell(strText.Substring(0, 1)).ToUpper();
}
static public string getSpell(string cnChar)
{
byte[] arrCN = Encoding.Default.GetBytes(cnChar);
if (arrCN.Length > 1)
{
int area = (short)arrCN[0];
int pos = (short)arrCN[1];
&nbs
相关文档:
System.Drawing.Image watermark = System.Drawing.Image.fromFile(Server.MapPath("watermark.gif"));
Bitmap srcImg = new Bitmap(Server.MapPath("example.jpg"));
Graphics graphics = Graphics.fromImage(srcImg);
graphics.DrawImage(watermark,
srcImg.Width - watermark.Width,
srcImg.Height - w ......
Bitmap srcImg = new Bitmap(300, 300); //也可以读入一张图片
Graphics graphics = Graphics.fromImage(srcImg);
Font font = new Font("宋体", 16); //字体与大小
Brush brush = new SolidBrush(Color.Red);
graphics.DrawString("www.cftea.com", font, brush, 50, 50); //写字,最后两个参数表示位置
Pen pen = ne ......
1. config结构
Framework\Config\Machine.config, 为所有config的根,特别只有它才能具有<processMode>节,该节修改后必须重启IIS方能生效,而其它节的改动,只要一保存,就有效了,这是IIS6的一大进步。
以下分别是从上往下的几个家族类(为继承关系,这种设计可以大 ......
· 第一:
private void Button1_Click( object sender, System.EventArgs e )
{
Response.Redirect( Request.Url.ToString( ) );
}
第二:
private void Button2_Click( object sender, System.EventArgs e ......