remove-all-lazy.dart (277B)
1 //Lazy solution to the problem 2 //Remove first instance of the string while it is contained 3 //in the list. 4 class Solution { 5 String removeOccurrences(String s, String part) { 6 while(s.contains(part)){ 7 s = s.replaceFirst(part, ""); 8 } 9 return s; 10 } 11 }