18

I want to check weather a String contains or not a specific substring in dart/flutter.

example

String mainString = "toyota allion 260 2010";
String substring = "allion";

I want to check weather substring is in the mainString or not?

Please help me to find a solution

1 Answer 1

47
String mainString = "toyota allion 260 2010";
String substring = "allion";

mainString.contains(substring); //return true if contains
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.