/// <summary>
/// 아이디 영문자와 숫자만 받기
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public static bool Chkidalpha(string id)
{
 bool bResult = false;

 Regex rexid = new Regex(@"^([a-zA-Z0-9])");

 int cnt = id.Length;

 for (int i = 0; i < cnt; i++)
 {
  if (!rexid.IsMatch(id.Substring(i, 1)))
  {
   bResult = true;
  }
 }
 return bResult;
}
/// <summary>
/// 아이디 첫글자는 영문자만 허용하자
/// </summary>
/// <param name="id"></param>
/// <returns></returns>
public static bool ChkidFirst(string id)
{
 bool bResult = false;

 Regex rexid = new Regex(@"^([a-zA-Z])");

 if (!rexid.IsMatch(id.Substring(0, 1)))
 {
  bResult = true;
 }
 return bResult;
}

'ASP.NET' 카테고리의 다른 글

SMTP를 이용한 메일 발송  (0) 2015.05.28
이메일 유효 테스트  (0) 2015.05.28
Base64 Encode & Decode  (0) 2015.05.28
DataSet를 액셀로 저장하기  (0) 2015.05.28
문자열을 MD5로 암호화  (0) 2015.05.28
Posted by 따랑
,