2011-04-07 55 views

回答

5

喜歡的東西:

NSRange r = [abcd rangeOfString:@"#"]; 
if (r.location!=NSNotFound) 
    abcd=[abcd substringToIndex:r.location-1]; 
+0

感謝.... !!! :) – Sookcha 2011-04-07 13:19:08

+0

約NSArray的是什麼?它不適用於NSArray ... – Sookcha 2011-04-07 13:37:40

+0

你是什麼意思? – ssteinberg 2011-04-07 13:46:46

1
NSArray *chunks = [string componentsSeparatedByString: @"#"]; 

if ([chunks count] > 0) 
{ 

    NSLog(chunks[0]); 
}