Dart String Manipulations: Replacing & Searching

Jeet BhaluJeet Bhalu
1 min read

Replacing:

You can use replaceAll() method to use string method to use sentence change to use replaceAll() method

void main()
{
      String str = "hi kem cho?";

      String rep;

      rep = str.replaceAll('hi', 'jeet');

      print(rep);
}

Output:

jeet kem cho?

Searching:

A string in search keyword to use bool to answer is return to be true or false in sentence to check to word is not yet to answer is false and word is in sentence to answer is true.

void main()
{
        String searching ="Hiii , Jeet ";

        bool search;

        search= searching.contains('Jeet');

        print(search);

}

output:

true
0
Subscribe to my newsletter

Read articles from Jeet Bhalu directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Jeet Bhalu
Jeet Bhalu

i am Jeet Bhalu i am flutter App developer