0
我有一個字符串,我想提取一個子字符串。NSScanner返回文本的範圍
的文字是這樣的:
commentText=Hi+there%21&x=28&y=22
我想從第一=提取一切交給第一& X
所以,最終文本將僅僅是:
Hi there
*我知道我將不得不脫離文本後我得到它隔離
謝謝!
我有一個字符串,我想提取一個子字符串。NSScanner返回文本的範圍
的文字是這樣的:
commentText=Hi+there%21&x=28&y=22
我想從第一=提取一切交給第一& X
所以,最終文本將僅僅是:
Hi there
*我知道我將不得不脫離文本後我得到它隔離
謝謝!
嘗試類似的東西:
NSString *result = nil;
NSScanner *scanner = [NSScanner scannerWithString: commentText=Hi+there%21&x=28&y=22];
[scanner scanUpToString:@"=" intoString:nil];
[scanner scanUpToString:@"&" intoString:&result];
這工作!我只需要做一個子字符串,因爲'='仍然存在:result = [result substringFromIndex:1]; – 2011-01-20 22:08:51
刪除標籤 '的Xcode' http://stackoverflow.com/tags/xcode/info – vikingosegundo 2011-02-14 18:21:25