How to use replaceAll() function in dart?
replaceAll() is a string method. It is used to replace all occurrences of the specified substring inside a string with another substring.
Syntax:
actualString.replaceAll( oldSubstring, newSubstring );
Lets understand with an example :
void main() {
String sampleString = "I develop, I test.";
print(sampleString);
String replacedString = sampleString.replaceAll( "I", "We" );
print(replacedString);
}
Output:
I develop, I test.
We develop, We test.
Explanation: We have replaced this substring “I” with the new substring “We“.