怎么样asp.net汉字转拼音和获取汉字首字母的代码
以下是我的源代码
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Book_View.aspx.cs" Inherits="KeLin.WebSite.download.Book_View" %><%@ Import namespace="KeLin.ClassManager.Tool" %><%
Response.Write(WapTool.showTop(bookVo.book_title, wmlVo));//显示头
if (ver == "1")
{
strhtml.Append("<p align=\"" + classVo.position + "\">");
//显示广告
if (adVo.threeShowTop != "")
{
strhtml.Append(adVo.threeShowTop + "<br/>");
}
strhtml.Append("【书名】" + bookVo.book_title + "<br/>");
string strImg = ""; //图片链接
StringBuilder strDown = new StringBuilder(); //文件下载
for (int i = 0; (filelist != null && i < filelist.Count); i++)
{
if (".gif|.jpg|.jpeg|.png|.bmp|".IndexOf(filelist[i].book_ext.ToLower()) >= 0)
{
if (filelist[i].book_file.StartsWith("/") || filelist[i].book_file.ToLower().StartsWith("http://"))
{
strImg = strImg + ("<img src=\"" + filelist[i].book_file + "\" alt=\"load...\"/><br/>");
}
else
{
strImg = strImg + ("<a href=\"" + this.http_start + "download/picDIY.aspx?sp=" + this.sp + "&siteid=" + this.siteid + "&classid=" + this.classid + "&id=" + this.id + "&path=" + HttpUtility.UrlEncode(@"download\" + filelist[i].book_file) + "&sid=" + this.sid + "\"><img src=\"" + this.http_start + "download/" + filelist[i].book_file + "\" alt=\"load...\"/></a><br/>");
}
if (filelist[i].book_content != "")
{
strImg = strImg + (filelist[i].book_content + "<br/>");
}
ImgList.Add(strImg);
strImg = "";
}
else
{
strDown.Append("");
strDown.Append("<a href=\"" + this.http_start + "download/download.aspx?sp=" + this.sp + "&siteid=" + this.siteid + "&classid=" + this.classid + "&book_id=" + this.id + "&sid=" + this.sid + "&id=" + filelist[i].ID + "&RndPath=" + siteVo.SaveUpFilesPath + "&n=" + HttpUtility.UrlEncode(filelist[i].book_title) + "." + filelist[i].book_ext.Replace(".", "") + "\">" + filelist[i].book_ext.Replace(".", "") + "格式(大小" + filelist[i].book_size + ")</a><br/>");
strDown.Append(filelist[i].book_content + "");
}
}
//对ImgList进行分页
if (pview == 0)
{
for (int i = 0; i < ImgList.Count; i++)
{
strhtml.Append(ImgList[i]);
}
}
else if (ImgList.Count > 1)
{
if (pview > ImgList.Count || pview < 1) pview = 1;
strhtml.Append(ImgList[pview - 1]);
//生成分页图链接
strhtml.Append("<a href=\"" + this.http_start + "download/book_view.aspx?sp=" + this.sp + "&siteid=" + this.siteid + "&classid=" + this.classid + "&id=" + this.id + "&pview=0&lpage=" + this.lpage + "&sid=" + sid + "\">截图</a>:");
for (int i = 1; i <= ImgList.Count; i++)
{
if (pview == i)
{
strhtml.Append(i + " ");
}
else
{
strhtml.Append("<a href=\"" + this.http_start + "download/book_view.aspx?sp=" + this.sp + "&siteid=" + this.siteid + "&classid=" + this.classid + "&id=" + this.id + "&pview=" + i + "&lpage=" + this.lpage + "&sid=" + sid + "\">" + i + "</a> ");
}
}
strhtml.Append("<br/>");
}
else if (ImgList.Count == 1)
{
strhtml.Append(ImgList[0]);
}
{
}
if (bookVo.money > 1)
{
strhtml.Append("【扣币 " + bookVo.money + "枚】");strhtml.Append("<a href=\"" + this.http_start + "download/book_se.aspx?sp=" + this.sp + "&siteid=" + this.siteid + "&classid=" + this.classid + "&page=" + this.lpage + "&sid=" + this.sid + "\">获取铜板</a><br/>");
}
strhtml.Append("【作者】<a href=\"" + this.http_start + "download/Book_List.aspx?action=search&siteid=" + this.siteid + "&classid=0&key=" + bookVo.updateInfo + "&type=title&sid=" + this.sid + "\">" + bookVo.updateInfo + "</a><br/>");
strhtml.Append("【分类】<a href=\"" + this.http_start + "download/book_list.aspx?sp=" + this.sp + "&siteid=" + this.siteid + "&classid=" + this.classid + "&page=" + this.lpage + "&sid=" + this.sid + "\">" + classVo.classname + "</a><br/>");
strhtml.Append("【阅读】<a href=\"http://ad2.easou.com:8080/j10ad/ea.jsp?channel=2&cid=bccn3506_44643_D_1&key=" + bookVo.book_title + "\">在线试读本书</a><br/>");
strhtml.Append("【更新】" + string.Format("{0:yyyy-MM-dd}", bookVo.book_date) + "<br/>");
if (bookVo.updateInfo != "")
if (content != "")
{
strhtml.Append("【简介】");
if (view != "all" && this.content.Length > 100)
{
strhtml.Append(content.Substring(0, 100) + "...");
strhtml.Append("<a href=\"" + http_start_url + "&id=" + this.id + "&vpage=2&view=all\">[更多..]</a>");
}
else
{
strhtml.Append(content);
}
strhtml.Append("<a href=\"" + this.http_start + "download/Report_add.aspx?sp=" + this.sp + "&siteid=" + this.siteid + "&classid=" + this.classid + "&page=" + this.lpage + "&id=" + this.id + "&sid=" + this.sid + "\"><br/>举报(电子书不良信息)</a>");
strhtml.Append("<a href=\"" + this.http_start + "download/book_view1.wml?sp=" + this.sp + "&siteid=" + this.siteid + "&classid=" + this.classid + "&page=" + this.lpage + "&sid=" + this.sid + "\"><br/>帮助(小说疑难杂症解决)</a>");
//显示内容列表
strhtml.Append("<br/><b>-=电子书下载地址=-</b><br/>");
}
strhtml.Append(strDown);
if (filelist == null || filelist.Count < 1)
{
if (this.myua != "" && this.myua != "0")
{
strhtml.Append("暂无适合" + mobileVo.nameCN + " " + mobileVo.Mode + " 的记录!<br/>");
}
}
if (dlist != null && filelist != null)
{
if (dlist.Count != filelist.Count)
{
strhtml.Append("<a href=\"" + this.http_start + "download/book_viewua.aspx?sp=" + this.sp + "&siteid=" + this.siteid + "&classid=" + this.classid + "&lpage=" + this.lpage + "&id=" + this.id + "&sid=" + this.sid + "\">该软件还支持其他机型</a>");
}
}
strhtml.Append("已有(" + bookVo.book_click + ")人浏览过该书<br/>");
strhtml.Append("<a href=\"" + http_start + "download/book_view.aspx?sp=" + this.sp + "&siteid=" + siteid + "&classid=" + classid + "&state=1&lpage=" + lpage + "&id=" + id + "&sid=" + sid + "\">好看顶一下!" + bookVo.ding + "</a>|<a href=\"" + http_start + "download/book_re.aspx?sp=" + this.sp + "&pageback=&getTotal=" + bookVo.book_re + "&id=" + id + "&classid=" + classid + "&siteid=" + siteid + "&sid=" + sid + "\">发表书评" + bookVo.book_re + "</a><br/> ");
strhtml.Append("----------<br/>");
//显示上一页下一页,可关闭加速性能
strhtml.Append(bll.GetPreNextTitle(ver, lang, http_start_url, siteid, classid, id, order, condition));
//显示评论
if ("1".Equals(showRe))
{
//显示最新回复
strhtml.Append("文明社会,文明评论<br/><input type=\"text\" name=\"con" + r + "tent\" value=\"\" maxlength=\"200\"/><br/>");
strhtml.Append("<anchor><go href=\"" + http_start + "download/book_re.aspx\" method=\"post\" accept-charset=\"utf-8\">");
strhtml.Append("<postfield name=\"action\" value=\"add\"/>");
strhtml.Append("<postfield name=\"id\" value=\"" + id + "\"/>");
strhtml.Append("<postfield name=\"siteid\" value=\"" + siteid + "\"/>");
strhtml.Append("<postfield name=\"lpage\" value=\"" + lpage + "\"/>");
strhtml.Append("<postfield name=\"content\" value=\"$(con" + r + "tent)\"/>");
strhtml.Append("<postfield name=\"classid\" value=\"" + classid + "\"/>");
strhtml.Append("<postfield name=\"sid\" value=\"" + sid + "\"/>");
strhtml.Append("<postfield name=\"backurl\" value=\"" + HttpUtility.UrlEncode("download/book_view.aspx?siteid=" + siteid + "&classid=" + classid + "&id=" + id) + "\"/>");
strhtml.Append("</go>发表评论</anchor><br/>");
for (int i = 0; (relistVo != null && i < relistVo.Count); i++)
{
strhtml.Append("[" + (bookVo.book_re - k) + "楼]");
if (relistVo[i].content.Length > 10)
{
strhtml.Append(relistVo[i].content.Substring(0, 9) + "...(" + string.Format("{0:MM-dd HH:mm}", relistVo[i].redate) + ")<br/>");
}
else
{
strhtml.Append(relistVo[i].content + "(" + string.Format("{0:MM-dd HH:mm}", relistVo[i].redate) + ")<br/>");
}
k = k + 1;
}
if (relistVo == null)
{
strhtml.Append("暂无评论!<br/>");
}
else
{
strhtml.Append("<a href=\"" + http_start + "download/book_re.aspx?pageback=&getTotal=" + bookVo.book_re + "&id=" + id + "&classid=" + classid + "&siteid=" + siteid + "&sid=" + sid + "\">更多评论(" + bookVo.book_re + ")</a><br/>");
}
}