StringUtils indexOf

By | April 13, 2020

StringUtils indexOf method returns the index of the first occurrence of the specified character from a string. If it doesn’t find the character then it returns -1. A null CharSequence will return -1.

Syntax:

StringUtils.indexOf (CharSequence seq, CharSequence searchSeq);

Parameters:

  • seq the CharSequence to check, may be null
  • searchSeq the CharSequence to find, may be null

Returns: the first index of the search CharSequence,-1 if no match or null string input

Since:
2.0
3.0 Changed signature from indexOf(String, String) to indexOf(CharSequence, CharSequence)

Examples:

 

Recommended Posts:

Arrays.copyOf() method in java

StringUtils equalsAny() method

Leave a Reply

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