How to replace all occurrences of multiple characters in a string with Dart

1 Answer

0 votes
void main() {
    String str = "abcdefghijklmnopqrstuvwxyz";
  
    str = str.replaceAllMapped(new RegExp(r'[aeiou]'), (match) {
        return '*';
    });
  
    print(str);
}
 
 
 
/*
run:
 
*bcd*fgh*jklmn*pqrst*vwxyz
 
*/

 



answered Oct 18, 2022 by avibootz

Related questions

...