字符串截取(包括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 ......
set ANSI_NULLS ON
set QUOTED_IDENTIFIER ON
Go
----截取字符串,并出去html
create FUNCTION [dbo].[CutString] (@str varchar(1000),@length int)
RETURNS varchar(1000) AS
BEGIN
declare @mainstr varchar(1000)
declare @substr varchar(1000)
if(@str is not null or @st ......
直接封装成一个类的,用起来还挺方便的
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text ......
<p>: 格式化段落; <h1>,<h6> 标题; <blockquote>-- 引用的文本; <pre>--预先格式化好的文本;保留原有的格式.
<ol><dl><ul>:顺序列表,定义列表,无标号列表. <li>用以显示单个的元素; <dl><dt><dd></dd></dt><dl>
< ......
<!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 ......