string2 [C#] ToInt, Convert to int www.dreamy.pe.kr/zbxe/CodeClip/142782 C# 형변환 (문자형 -> 숫자형) / C# Type Change (string -> number) C#에서 Textbox안에 쓰여진 모든 것은 문자로 받아들여집니다. 이 때 문자형으로 받아들여진 숫자를 산술 계산을 위해 숫자로 변환해야 할 일이 자주 발생하죠. Everything is inputed in Textbox in C#, adapt www.dreamy.pe.kr 이 블로그가 굉장히 설명을 잘 해놨다. 감사합니다. 2021. 3. 21. [C#] 문자열이 모두 숫자인지 아닌지 판별. isdigit를 이용함 public static class StringExtension { /// /// True if all characters in a string is IsDigit(true), False if not /// /// /// public static bool IsNumber(this string me) { foreach (char ch in me) { if (!Char.IsDigit(ch)) return false; } return true; } } Sting Class의 확장 함수이다. 번호가 한개라도 섞여있으면 False가 리턴된다. private void Form1_Load(object sender, EventArgs e) { string a = "1000"; string b = "hi"; string.. 2021. 3. 17. 이전 1 다음