2010-08-10 8 views
1

Je cherche une méthode Objective-C comme la fonction exploser PHP:Convertir NSString en NSArray

$string = "Helle#world#!"; 
$delimiter = "#"; 
$array = explode ($delimiter, $string); 

Résultat: $ array = { "Bonjour", "monde", "!"}

Merci, Andreas

Répondre

6

vous cherchez componentsSeparatedByString:

NSString *string = @"Hello#world#!"; 
NSString *delimiter = @"#"; 
NSArray *array = [string componentsSeparatedByString:delimiter]; 
+0

Merci. C'est ce que je cherchais. :-) –