Dart String Manipulations: Replacing & Searching

Dart String Manipulations: Replacing & Searching

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