StringUtils endsWith

By | April 22, 2020

StringUtils endsWith method checks if a string ends with a specified character/suffix and return true otherwise returns false.

nulls are handled without exceptions. Two null references are considered to be equal. The comparison is case sensitive.



Below are the methods provided in StringUtils class and these are all null safe.

Equals/Compare: It compares whether two given strings are equal or not.
EqualsAny: Compares if the first string is equal to the given searchStrings.
IsEmpty/IsBlank: checks if a String contains text
Trim/Strip: removes leading and trailing whitespace from string.
startsWith: check if a String starts with a prefix / specified characters
endsWith: check if a String ends with a suffix / specified characters.
UpperCase/LowerCase/SwapCase/Capitalize/Uncapitalize: Used to change the case of a String
IndexOf/LastIndexOf/Contains: checks the index of string
IndexOfAny/LastIndexOfAny/IndexOfAnyBut/LastIndexOfAnyBut: Checks the index of given Strings
ContainsOnly/ContainsNone/ContainsAny: does String contains only/none/any of these characters
IsAlpha/IsNumeric/IsWhitespace/IsAsciiPrintable: checks the characters in a String

Reverse/ReverseDelimited: It reverses a String
Substring/Left/Right/Mid: It extracts substrings
SubstringBefore/SubstringAfter/SubstringBetween: substring extraction relative to other strings
Split/Join: Splits a String into an array of substrings and vice versa
Remove/Delete: It removes part of a String
Replace/Overlay: Searches a String and replaces one String with another
LeftPad/RightPad/Center/Repeat: It adds padding to a String


Recommended Posts:

All StringUtils methods with examples

Get last 4 chars from String

Convert String to String array

SQL quick reference for interview preparation

Source: Apache

Tags: stringutils endswith

Leave a Reply

Your email address will not be published. Required fields are marked *