Checks if a string is an anagram of another string in Dart- isAnagram
Tue Apr 28 2020 19:52:02 GMT+0000 (UTC)
Saved by @toast-ghost #dart
Use String.toLowerCase() and String.prototype.replaceAll() with an appropriate regular expression to remove unnecessary characters and convert the string to lowercase. Use String.split(''), Iterable.sort(), in combination with the cascade operator (..) and Iterable.join('') to normalize both strings and check if their normalized forms are equal.
https://www.30secondsofcode.org/dart/s/is-anagram/
Comments