String replaceAll() Method

  • Post author:
  • Post category:Dart
  • Post comments:2 Comments
String replaceAll() Method

In this guide, we will discuss the String replaceAll() Method in Dart Programming Language. Replaces all substrings that match the specified pattern with a given value.

Syntax

String replaceAll(Pattern from, String replace)

Parameters

  • From − the string to be replaced.
  • Replace − the substitution string.

Return Type

Returns a string.

Example

void main() { 
   String str1 = "Hello World"; 
   print("New String: ${str1.replaceAll('World','ALL')}"); 
} 

It will produce the following output −.

New String: Hello ALL 

Next Topic : Click Here

This Post Has 2 Comments

Leave a Reply