Skip to content

StringUtils.contains

Signature: StringUtils.contains(inputString, searchString)

Returns: Boolean result - true if the inputString contains the searchString, false if not or null inputString

Checks if inputString contains the searchString, handling null. A null inputString will return false.

Parameters

Type Name Description Default
String inputString the String to check, may be null
String searchString the String to find, may be null

Example

var text = "Do I contain what you are looking for?";
var containsQuestionMark = StringUtils.contains(text, "?");
// containsQuestionMark == true