Logo

Programming-Idioms

History of Idiom 39 > diff from v52 to v53

Edit summary for version 53 by programming-idioms.org:
[Scala] +DocURL, +comments

Version 52

2020-10-10, 22:22:17

Version 53

2020-11-21, 23:55:04

Idiom #39 Check if string contains a word

Set boolean ok to true if string word is contained in string s as a substring, or to false otherwise.

Idiom #39 Check if string contains a word

Set boolean ok to true if string word is contained in string s as a substring, or to false otherwise.

Variables
ok,word,s
Variables
ok,word,s
Code
val ok = s.contains(word)
Code
val ok = s.contains(word)
Comments bubble
s and word have type java.lang.String
Doc URL
https://docs.oracle.com/javase/8/docs/api/java/lang/String.html#contains-java.lang.CharSequence-