using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Microsoft.VisualBasic; //참조추가
namespace changeFullorHalfJananese
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
String strText = textBox1.Text;
string strTextWide = Microsoft.VisualBasic.Strings.StrConv(strText, VbStrConv.Wide); //전각
string strTextNarrow = Microsoft.VisualBasic.Strings.StrConv(strTextWide, VbStrConv.Narrow); //반각
//MessageBox.Show("半角 : " + strTextNarrow + System.Environment.NewLine + "全角 : " + strTextWide);
MessageBox.Show("半角 : " + strTextNarrow + "\r\n" + "全角 : " + strTextWide);
}
}
}
[출처] 일본어 전각 반각 변환하기|작성자 제네식암흑햏자
-----------------------------------------------------------------
char c;
int byteCount = System.Text.Encoding.UTF8.GetByteCount(new char[]{c});
if (byteCount > 1)
{
// 전각
}
else
{
// 반각
}