2012-06-20 94 views
0

可能重複:
Objective C: How to extract part of a String (e.g. start with '#')獨立部分

我想給幾個部分來劃分的字符串。我的字符串是:

NSString * myString = @"Multiply top and bottom to get < mathtype x3y2z3 over x3yz2 >,now cancel down the powers of <i>x, y, z</i>.If you prefer, you can cancel down before you start multiplying."; 

我需要三個部分。 1.乘頂部和底部得到 2. <在x3yz2 MathType的x3y2z3> 3,現在取消倒<我> X,Y,Z </I>。如果你願意,你可以取消前順着權力你開始繁殖。

我怎樣才能做到這一點?

回答

0

如果上述失敗,您可以隨時將其轉換爲字符數組並循環。

- (const char *)cStringUsingEncoding:(NSStringEncoding)encoding 

有在NSString Docs

更多細節