?? cls_pda.cs
字號:
using System;
using System.Text;
namespace PDA_test
{
/// <summary>
/// CLS_PDA 的摘要說明。
/// </summary>
public class CLS_PDA
{
public CLS_PDA()
{
//
// TODO: 在此處添加構造函數邏輯
//
}
public static int LenB(string Str)
{
return System.Text.Encoding.Default.GetByteCount(Str);
}
public static string LStrB(string Str, int Length, bool Flag)
{
int L = LenB(Str);
if ( L < Length )
{
if ( Flag == true )
{
return Str + new string(' ',Length - L);
}
else
{
return Str;
}
}
for (int i = 1 ; i <= Str.Length; i++)
{
L = LenB(Str.Substring(0, i));
if ( L >= Length )
{
if ( L == Length )
{
return Str.Substring(0, i);
}
else
{
if ( Flag == true )
{
return Str.Substring(0, i - 1) + " "; //處理半個漢字;
}
else
{
return Str.Substring(0, i - 1);
}
}
}
}
return "";
}
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -