public string PhoneNumber(string pPhone)
{
string b = "";
if (pPhone.Length == 9)
b = pPhone.Substring(0, 2) + "-" + pPhone.Substring(2, 3) + "-" + pPhone.Substring(5, 4);
else if (pPhone.Length == 10)
{
if (pPhone.Substring(0, 2) == "02")
b = pPhone.Substring(0, 2) + "-" + pPhone.Substring(2, 4) + "-" + pPhone.Substring(6, 4);
else
b = pPhone.Substring(0, 3) + "-" + pPhone.Substring(3, 3) + "-" + pPhone.Substring(6, 4);
}
else if (pPhone.Length == 11)
b = pPhone.Substring(0, 3) + "-" + pPhone.Substring(3, 4) + "-" + pPhone.Substring(7, 4);
else if (pPhone.Length == 12)
b = pPhone.Substring(0, 4) + "-" + pPhone.Substring(4, 4) + "-" + pPhone.Substring(8, 4);
else
b = pPhone;
return b;
}
댓글 없음:
댓글 쓰기