Name

contains( )

Synopsis

                     boolean contains(string s1, string s2)

This function returns true if s2 is a substring of s1—that is, if s1 contains s2. Otherwise, it is false. For example, contains("A very Charming cat", "Charm") is true, but contains("A very Charming cat", "Marjorie") is false. The test is case-sensitive. For example, contains("A very charming cat", "Charm") is false. Nonstrings may also be passed to this function, in which case they’re automatically converted to strings as if by the string() function.

Get XML in a Nutshell, 3rd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.