常用小方法 續

2021-05-27 10:30:58 字數 744 閱讀 5296

#region 擷取字元長度

///

/// 擷取字元長度

///

/// 字元

/// 長度

///

public static string cutstring(string inputstring, int len)

else

trycatch

if (templen > len)

break;

}//如果截過則加上半個省略號

byte mybyte = system.text.encoding.default.getbytes(inputstring);

if (mybyte.length > len)

tempstring += "…";

return tempstring;

}#endregion

#region 清除html標記

public static string drophtml(string htmlstring)

#endregion

#region txt**轉換成html格式

///

/// 字串字元處理

///

/// 等待處理的字串

/// 處理後的字串

/// //把txt**轉換成html格式

public static string tohtml(string input)

#endregion

常用小方法

region 將字串轉換為陣列 public static string getstrarray string str endregion region 刪除最後結尾的乙個逗號 刪除最後結尾的乙個逗號 public static string dellastcomma string str endr...

常用小方法 後續

region html 轉換成txt格式 字串字元處理 等待處理的字串 處理後的字串 把html 轉換成txt格式 public static string totxt string input endregion region 檢查危險字元 檢查危險字元 public static string ...

常用小方法整理3

錯排公式 n各有序的元素應有n!種不同的排列。如若乙個排列式的所有的元素都不在原來的位置上,則稱這個排列為錯排。核心遞推公式 d n n 1 d n 2 d n 1 特殊地,d 1 0,d 2 1.尤拉迴路的判定 一.無向圖 乙個無向圖存在尤拉路徑,當且僅當 該圖所有頂點的度數為偶數或者除了兩個度數...