// 한글 받침 유무 체크
bool isExistLastSyllable(char ch)
{
int n = Convert.ToInt32(ch);
// 한글의 제일 처음과 끝의 범위밖일 경우는 예외처리
if (n < 0xAC00 || n > 0xD7A3)
{
throw new Exception("한글이 아님");
}
if((n - 0xAC00) % 28 > 0)
{
return true;
}
else
{
return false;
}
}
char ch = '손';
try
{
bool bExist = isExistLastSyllable(ch);
Console.WriteLine($"{ch}{(bExist ? "은":"는")} 받침이 {(bExist?"있다":"없다")}");
}
catch(Exception ex)
{
Console.WriteLine(ex.Message);
}