字符串截取(包括html,BasicPage.cs类使用)
/// <summary>
/// 截断字符串(中文计一个字符宽度,其它计半个字符宽度)
/// </summary>
/// <param name="input">需截断的字符串</param>
/// <param name="length">字符宽度</param>
/// <returns>截断字符串(带"...")</returns>
protected string truncatedChars(string input, int length)
{
input = Server.HtmlEncode(input);
if (input.Length > length)
{
int pos = 0;
string result = "";
foreach (char chr in input)
{
if (Regex.IsMatch(chr.ToString(), "[^\x00-\xff]"))
{
pos += 2;
}
else
{
pos += 1;
}
result += chr.To
相关文档:
当输入 》时自动补全 当输入《/时自动补全
“=================================
" File: closetag.vim
" Summary: Functions and mappings to close open HTML/XML tags
" Uses: <C-_> -- close matching open tag
" Author: Steven Mueller <di ......
flex嵌入到html:
用swfobject,下载的.js地址:http://www.adobe.com/devnet/activecontent/articles/devletter.html
在你的 HTML 页面头部<head>区嵌入这个脚本文件:<script type="text/javascript" src="swfobject.js"></script>
在你的 HTML 中写一个用来放 Flash 的容器,比如<div> ......
<p>: 格式化段落; <h1>,<h6> 标题; <blockquote>-- 引用的文本; <pre>--预先格式化好的文本;保留原有的格式.
<ol><dl><ul>:顺序列表,定义列表,无标号列表. <li>用以显示单个的元素; <dl><dt><dd></dd></dt><dl>
< ......
在做一个聊天记录的时候遇到这样一个问题,之前写入的带有特殊标记的文字,在写入数据库再读取的时候,带有html标记,
在后台调试,设置断点,取出的数据(hgjghj)(包括样式),
用文本可视化查看 为 :<FONT color=#e6421a>hgjghj</FONT>
用HTML可视化查看 为:<FO ......
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head>
<title>文本编辑器</title>
<meta http-equiv="C ......