#region 半角转换为全角
/// <summary>
/// 半角转换为全角
////转全角的函数(SBC case)
///任意字符串
///全角空格为12288,半角空格为32
///其他字符半角(33-126)与全角(65281-65374)的对应关系是:均相差65248
/// </summary>
/// <param name="input"></param>
/// <returns></returns>
public String ToSBC(String input)
{
// 半角转全角:
char[] c = input.ToCharArray();
for (int i = ; i < c.Length; i++)
{
if (!IsWhole(input))
{
if (c[i] == )//转换空格
{
c[i] = (char);
continue;
}
if (c[i] < )
c[i] = (char)(c[i] + ); }
}
return new String(c);
} /// <summary>
/// 判断是否为全角
/// </summary>
/// <param name="checkString"></param>
/// <returns></returns>
public bool IsWhole(string checkString)
{
string containNUmWordS = @"^[a-z|A-Z|0-9|\u4e00-\u9fa5\' '()]*$";//有数字字母汉字空格
return Regex.IsMatch(checkString, containNUmWordS);
}
#endregion
05-07 11:53