This course is currently a work in progress. Please join the waitlist to receive regular updates.
String Contains in Apex
String contains in apex is to check if the given string contains another string. The contains() method is a built in function provided by apex.
Following is an example of using contains method in apex:
Loading...
In the above example:
- In the above example, two string variables,
string1
andstring2
, are declared with default values. - The
contains()
method checks if string1 contains string2. - The
Contains()
method returns a boolean value indicating whether one string contains the other.
Try It Yourself
Loading...