---
title: "OC 字符串合并"
author: "修博龙泉"
date: "2012-09-25T10:33:31Z"
tags: []
categories: ["移动开发"]
slug: "oc"
draft: false
lastmod: "2012-09-25T10:33:31Z"
id: 1684847
url: "https://longquan.iteye.com/blog/1684847"
---

```java
NSString* result; // 结果字符串
NSString* string1, string2; //已存在的字符串

1. result = [nsstring initwithformat:@"%@,%@", string1, string2 ];
2. result = [string1 stringbyappendingstring:string2];
3 . result = [result stringbyappendingformat:@"%@,%@",string1, string2];
```