RosettaCodeData/Task/Sort-an-array-of-composite-.../FutureBasic/sort-an-array-of-composite-...

24 lines
846 B
Plaintext

void local fn DoIt
CFArrayRef x = @[
@{@"name":@"07-01",@"value":@"The Times They Are A-Changin'"},
@{@"name":@"05-08",@"value":@"Mr. Tambourine Man"},
@{@"name":@"06-09",@"value":@"Desolation Row"},
@{@"name":@"02-01",@"value":@"Blowin' In The Wind"},
@{@"name":@"04-04",@"value":@"Chimes Of Freedom"},
@{@"name":@"07-07",@"value":@"Leopard-Skin Pill-Box Hat"},
@{@"name":@"06-01",@"value":@"Like A Rolling Stone"},
@{@"name":@"01-12",@"value":@"Song To Woody"},
@{@"name":@"07-03",@"value":@"Visions Of Johanna"},
@{@"name":@"02-06",@"value":@"A Hard Rain's A-Gonna Fall"}]
SortDescriptorRef sd = fn SortDescriptorWithKey( @"name", YES )
CFArrayRef array = fn ArraySortedArrayUsingDescriptors( x, @[sd] )
for CFDictionaryRef pair in array
print pair[@"name"],pair[@"value"]
next
end fn
fn DoIt
HandleEvents