Ns_Set **Ns_SetSplit( Ns_Set *set, char sep );
The Ns_SetSplit function assumes that each key name in the fields of a set contains a separating character. The fields of the set are partitioned into new sets whose set names are the characters before the separator and whose field key names are the characters after the separator. For example, if the separator is `.' and the set has fields whose key names are the following:
dog.sound dog.food cat.sound cat.food
Ns_SetSplit would create two new sets named dog
and cat
, each containing two fields whose key names are sound
and food
.
Ns_SetSplit returns a newly allocated NULL-terminated array of new sets. The original set is left unaltered. The list of new sets can be freed at once with the Ns_SetListFree function.