본문 바로가기

프로그래밍

[iOS] NSString의 문자열 관련 주요 함수 모음 프로그램을 개발하다보면 개발 언어와 무관하게 가장 많이 쓰이는 함수 중 하나가 문자열과 관련된 함수 일 것입니다.아이폰 어플 개발에서도 마찬가지 인데, Objective C의 NSString 클래스의 주요 함수를 정리해 보았습니다. NSString 주요 함수 모음 지정된 Fomat String으로 문자열을 초기화 한다.- initWithFormat; + stringWithString: NSString *greet3 = [[NSString alloc] initWithFormat: "Hello, %@", @"World"]; Formatting 관련 주요 인자 %@: NSString objects %d: int %f: float / double %c: unsinged char %C: unichar %s: ar.. 더보기
[iOS] 객체들 간의 메시지 전달 - NSNotification 사용법 -일반적인 노티피케이션 사용법-:노티피케이션 센터에 등록을 해서 사용 1. 노티피케이션을 보내는 객체// NSNotificationCenter 객체를 선언하여 defaultCenter에 등록NSNotificationCenter *myNotificationCenter = [NSNotificationCenter defaultCenter]; // 노티피케이션을 보낼 때 같이 전송할 userInfo의 딕션너리 dic를 키값을 이용하여 저장NSDictionary *dic = [NSDictionary dictionaryWithObject:(전송할 객체) forKey:@”firstKey”]; // myNotificationCenter 객체를 이용하여 키값으로 어디든지 노티피케이션 전송 가능[myNotification.. 더보기
[ MFC ] ini 파일 입출력 Win32 API함수 (GetPrivateProfileString, WritePrivateProfileString) 파일에 쓸때: - 형식: WritePrivateProfileStringA( LPCWSTR lpAppName, LPCWSTR lpKeyName, LPCWSTR lpString, LPCWSTR lpFileName ); - 사용법: WritePrivateProfileString("카테고리", "파라메터", 저장하고자하는항목(변수), ini파일의 위치); 실 사용 예: char szCurDir[256] = {NULL, }; int port; CString strPort; GetCurrentDirectory(256, szCurDir); strcat(szCurDir, "\\server.ini"); strPort.Format("%d", port); WritePrivateProfileString("Server", "P.. 더보기
[ 주인장 ] C# 실습 [ 콘솔 이용해 룰렛 번호 찍기 ] ↑ 실행화면 ↑ 맞춘 화면 using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace Roulette { class Program { static void Main(string[] args) { int count = 0; // 입력 저장을 위한 카운트 int[,] Num = new int[5,9]; Random rand = new Random(); int[] SaveNum = new int[45]; int ComNum; int ReadNum; char conti; bool overlap = false; Console.WriteLine("################################.. 더보기