preferenceIntersection function
Choose the first algorithm that satisfies the conditions.
Implementation
String preferenceIntersection(String intersectCsv, String supportedCsv,
[bool server = false]) {
if (server) {
String swapCsv = intersectCsv;
intersectCsv = supportedCsv;
supportedCsv = swapCsv;
}
Set<String> supported = Set<String>.of(supportedCsv.split(','));
for (String intersect in intersectCsv.split(',')) {
if (supported.contains(intersect)) return intersect;
}
return '';
}