2012-03-02 2 views
0

약 20 줄의 텍스트를 사용할 때 바꿀 값이 필요합니다. createFileAtPath파일 템플릿을 만드시겠습니까?

[firstname] has a surname of [surname] 
and is [gender] 
etc etc etc 
etc etc etc 
etc etc etc 
etc etc etc 
and lives in [suburb] 

나는 사용자가 버튼

을 클릭하면 내 변수로 자리를 대체 할 수있는 곳이 템플릿 또는 상수의 일종을 작성하여 수행 할 수 있습니다이 파일을 여러 번 만들 필요가? NSString stringWithFormat 유사한 내가 NSRegularExpression 볼 것

[NSString stringWithFormat:myTemplate, person.firstname, person.surname, person.gender, person.suburb] 

답변

1

처럼 전화 - replaceMatchesInString : 옵션 : 범위 : withTemplate :. NSMutableString에있는 내용과 일치시킬 수 있습니다.

관련 문제