Created
March 22, 2022 20:29
-
-
Save Deleplace/54a942acc4fc4c1f020ebff3b7c5b540 to your computer and use it in GitHub Desktop.
Case-insensitive string contains
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() { | |
var s = "Let's dance the macarena"; | |
{ | |
var word = "Dance"; | |
bool ok = s.toUpperCase().contains(word.toUpperCase()); | |
print(ok); | |
} | |
{ | |
var word = "dance"; | |
bool ok = s.toUpperCase().contains(word.toUpperCase()); | |
print(ok); | |
} | |
{ | |
var word = "Duck"; | |
bool ok = s.toUpperCase().contains(word.toUpperCase()); | |
print(ok); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment