Computers/Language
2012. 8. 31. 10:36
C# - string 배열 선언시 주의및 패턴
http://codecrue.egloos.com/791716
string[] arrCarNames;
arrCarNames = new string[10];
arrCarNames[0] = "그랜져";
arrCarNames[1] = "소나타";
arrCarNames[2] = "포니";
http://www.mkexdev.net/Article/Content.aspx?parentCategoryID=1&categoryID=5&ID=683
//검색패턴(전화번호패턴: 3자리수 - 3자리수 - 4자리수)
string sPattern = "^\\d{3}-\\d{3}-\\d{4}$";
foreach (string s in numbers){
System.Console.Write("{0,14}", s);
if (System.Text.RegularExpressions.Regex.IsMatch(s, sPattern)){
System.Console.WriteLine(" - valid");
}
else{
System.Console.WriteLine(" - invalid");
}
}