tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Interviews | Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 Tools and Libs > Jodd > Strings > String first index ignorecase

String first index ignorecase 

Jodd is an open-source java library with lot of reusable components and feature rich utilities. This requires the library jodd-3.3.2.jar to be in classpath. The following example shows how to use StringUtil.indexOfIgnoreCase() API. It returns the first index of substring in the given string irrespective of the case.

File Name  :  
com/bethecoder/tutorials/jodd/utils/StringIndexIgnorecaseTest.java 
Author  :  Sudhakar KV
Email  :  [email protected]
   
package com.bethecoder.tutorials.jodd.utils;

import jodd.util.StringUtil;

public class StringIndexIgnorecaseTest {

  /**
   @param args
   */
  public static void main(String[] args) {
    System.out.println(StringUtil.indexOfIgnoreCase("abcd""Ab"));
    System.out.println(StringUtil.indexOfIgnoreCase("abcd""BcD"));
    System.out.println(StringUtil.indexOfIgnoreCase("be the coder"" THE "));
    System.out.println(StringUtil.indexOfIgnoreCase("abcd""ac"));
  }

}
   

It gives the following output,
0
1
2
-1



 
  


  
bl  br