Created
April 6, 2022 14:06
-
-
Save 9helix/d7f757ef86dfecd03714db38bdac8d8e to your computer and use it in GitHub Desktop.
custom sort dart
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() { | |
getFreq(n) { | |
return int.parse(n.substring(n.indexOf(';') + 1, n.length)); | |
} | |
final List<String> words = <String>['krak;56', 'mrak;1500', 'brak;480']; | |
words.sort((a, b) => getFreq(a).compareTo(getFreq(b))); | |
print(words); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment