Created
June 29, 2019 02:42
-
-
Save bradyt/52e330a6a70348c6229ee14e45d8abe6 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
var thing = ['a:b', 'c:d:e']; | |
var subaccounts = Set<String>(); | |
for (var t in thing) { | |
while (t.lastIndexOf(':') != -1) { | |
t = t.substring(0, t.lastIndexOf(':')); | |
subaccounts.add(t); | |
} | |
} | |
print(thing.toSet().union(subaccounts).toList()..sort()); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment