본문 바로가기

반응형

전체 글

(163)
c# string 문자열 byte[] 배열 private string ByteToString(byte[] strByte) { string str = Encoding.Default.GetString(StrByte); return str; } private byte[] StringToByte(string str) { byte[] StrByte = Encoding.UTF8.GetBytes(str); return StrByte; } 출처: https://zephie.tistory.com/11
VB 파일 Put # Put #파일 번호, [레코드 번호 또는 바이트 번호], 변수 ※ 레코드 번호 생략 시, 가장 최근 사용한 레코드의 다음 레코드로 지정된다. ※ 레코드 번호 범위 : 1 ~ 2,147,483,647 출처: https://icodebroker.tistory.com/2876
VB VisualStudio 비주얼스튜디오 .Action = 0 이란 fpSpread1.Action = 0 fpSpread1.Action = SS_ACTION_ACTIVE_CELL Activate Cell 모든 셀을 활성화 시키면서 지정한 셀로 이동한다. 출처 : [VB] Far Point Spread Sheet Action
[클린코드] 4장 주석 주석은 실패를 의미한다. 닫는 괄호에 주석 달기를 지향하고, 함수를 줄여라.
[클린코드] 3장 함수 함수 20줄 이내 추상화 수준 통일 함수 들여쓰기 최대 2단 무항 단항 : 대신 반환값 형식 동일 부수효과 일으키지 말 것 (예 : 비밀번호 체크하는 데 세션 초기화를 포함)
C# 리트코드 20. Valid Parentheses 검색 답안 public class Solution { public bool IsValid(string s) { Stack st = new Stack(); for (int i = 0; i < s.Length; i++) { Char c = s[i]; Char item; if (c == '(' || c == '{' || c == '[') { st.Push(c); } else { try { item = st.Pop(); } catch (Exception e) { return false; } if ( (c == ')' && item != '(') || (c == '}' && item != '{') || (c == ']' && item != '[')) { return false; } } } return st.Cou..
C# 리트코드 14. Longest Common Prefix Approach 1: Horizontal scanning public class Solution { public string LongestCommonPrefix(string[] strs) { if(strs.Length == 0) return ""; string prefix = strs[0]; for (int i = 1; i < strs.Length; i++) { while(strs[i].IndexOf(prefix) != 0) { prefix = prefix.Substring(0, prefix.Length - 1); if (string.IsNullOrEmpty(prefix)) return ""; } } return prefix; } } Approach 2: Vertical scanning public cl..
C# 리트코드 13. Roman to Integer C# 으로 제출한 답안 public class Solution { public int RomanToInt(string s) { int result = 0; string prev = string.Empty; for(int i = 0; i < s.Length; i++) { switch (s.Substring(i, 1)) { case "I": result += 1; break; case "V": if (prev == "I") result += 3; else result += 5; break; case "X": if (prev == "I") result += 8; else result += 10; break; case "L": if (prev == "X") result += 30; else result += 5..

반응형