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

C# substring完美截取HTML字符

注:此函数是在网上搜索得来,因此无法注明作者名,莫怪莫怪。嘿。
 /// <summary>
/// 按字节长度截取字符串(支持截取带HTML代码样式的字符串)
/// </summary>
/// <param name="content">将要截取的字符串参数</param>
/// <param name="length">截取的字节长度</param>
/// <param name="StripHTML">截取的结果是否为html代码</param>
/// <returns>截取的字符串</returns>
public static string GetContentSummary(string content, int length, bool StripHTML)
{
if (string.IsNullOrEmpty(content) || length == 0)
return "";
if (StripHTML)
{
System.Text.RegularExpressions.Regex re = new System.Text.RegularExpressions.Regex("<[^>]*>");
content = re.Replace(content, "");
content = content.Replace(" ", "").Replace(" ", "").Replace(" ", "");
if (content.Length <= length)
return content;
else
return content.Substring(0, length) + "...";
}
else
{
if (content.Length <= length)
return content;
int pos = 0, npos = 0, size = 0;
bool firststop = false, notr = false, noli = false;
System.Text.StringBuilder sb = new System.Text.StringBuilder();
while (true)
{
if (pos >= content.Length)
break;
string cur = content.Substring(pos, 1);
if (cur == "<")
{
string next = content.Substring(pos + 1, 3).ToLower();
if (next.IndexOf("p") == 0 && next.IndexOf("pre") != 0)
{
npos = content.IndexOf(">", pos)


相关文档:

Html页中使用OCX控件

最近准备开发一个b/s架构的应用程序需要用到activeX控件,web服务器尚未进入编码阶段,偶手上已有原用于vc客户端程序中的ocx控件,想测试一下此控件在普通网页上执行功能有无偏差,于是搞了个简单的html静态页面调用来测试OCX控件。
一 注册OCX控件
新建reg.txt文件
编辑
RegSvr32  TestOCX.ocx  //TestOCX是 ......

html的一些标准css样式

在html中,即使我们没有指定页面元素显示的css样式,元素也会按照默认的的标准css样式去显示。因此掌握基本的html标签可以在一定程度上精简你的css代码,现将html标签的默认属性进行一定的汇总如下:
li              { display: list-item } 
h ......

HTML IMAGE MAP标签的使用

http://www.htmlcodetutorial.com/images/images_famsupp_220.html
<DIV ALIGN=CENTER>
<MAP NAME="map1">
<AREA
HREF="contacts.html" ALT="Contacts" TITLE="Contacts"
SHAPE=RECT COORDS="6,116,97,184">
<AREA
HREF="products.html" ALT="Products" TITLE="Products"
SHAPE=C ......

c/s(C#)下Ftp的多文件上传及其上传进度

因为项目要求,制作的一个多文件上传,并显示进度条一段代码(vs2005环境)。
(只为粗略的实现,代码并不规范)
当多个文件上传的时候,需要依次队列形式一个个上传,当上传某个文件的时候,锁定进程,上传完毕再开启锁。
在主类中的上传按钮事件代码: 
//
获取openFileDialog控件选择的文件名数组(openFileDialog可 ......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号