Retrieving member user_ids that match certain fields

Short of writing a database query, is there an existing function that will retrieve an array of user_IDs for those members that match certain custom registration fields?
I imagine it would work something like below:
I imagine it would work something like below:
- Code: Select all
$field = 'favorite-fruit';
$fieldValue = 'apple';
$user_ids = get_S2custom_field($field, $fieldValue);