Skip to content

StringUtils.endsWith

Signature: StringUtils.endsWith(inputString, suffix)

Returns: Boolean result - true if the inputString ends with the suffix, case sensitive, or both null

Check if the inputString ends with a specified suffix. nulls are handled without exceptions. The comparison is case sensitive.

Parameters

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

Example

StringUtils.endsWith('Ronald jr', 'jr');    // true
StringUtils.endsWith("myFile.txt", ".txt"); // true
StringUtils.endsWith("myPDF.pdf", "jpg");   // false