using System;
using System.Text;
using System.Text.RegularExpressions;
namespace bjmti
{
/// <summary>
/// include 的摘要說明。
/// </summary>
public class include
{
public include()
{
//
// TODO: 在此處添加構造函數邏輯
//
}
#region 字符串截取函數
/// <summary>
/// 字符串截取函數
/// </summary>
/// <param name="inputString">要截取的字符串</param>
/// <param name="len">要截取的長度</param>
/// <returns>string</returns>
///
public static string CutString(string inputString,int len)
{
ASCIIEncoding ascii = new ASCIIEncoding();
int tempLen=0;
string tempString="";
byte[] s = ascii.GetBytes(inputString);
for(int i=0;i<s.Length;i++)
{
if((int)s[i]==63)
{
tempLen+=2;
}
else
{
tempLen+=1;
}
try
{
tempString+=inputString.Substring(i,1);
}
catch
{
break;
}
if(tempLen>len)
break;
}
// //如果截過則加上半個省略號
// byte[] mybyte=System.Text.Encoding.Default.GetBytes(inputString);
// if(mybyte.Length>len