半角与全角的转换


public static string CharConverter(string source)
{
    System.Text.StringBuilder result 
= new System.Text.StringBuilder(source.Length, source.Length);
    
for (int i = 0; i < source.Length; i++)
    
{
        
if (source[i] >= 65281 && source[i] <= 65373)
        
{
            result.Append((
char)(source[i] - 65248));
        }

        
else if (source[i] == 12288)
        
{
            result.Append(
' ');
        }

        
else
        
{
            result.Append(source[i]);
        }

    }


    
return result.ToString();
}
原文地址:https://www.cnblogs.com/Caesar/p/1016832.html