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

String equals one 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.equalsOneIgnoreCase() API. If the given string equals at least one string (ignorecase) from the provided array then it returns the string index in the array otherwise returns -1.

File Name  :  
com/bethecoder/tutorials/jodd/utils/StringEqualsOneIgnorecaseTest.java 
Author  :  Sudhakar KV
Email  :  kvenkatasudhakar@gmail.com
   
package com.bethecoder.tutorials.jodd.utils;

import jodd.util.StringUtil;

public class StringEqualsOneIgnorecaseTest {

  /**
   @param args
   */
  public static void main(String[] args) {
    String[] dest = "one""two""three""four" };
    System.out.println(StringUtil.equalsOneIgnoreCase("One", dest));
    System.out.println(StringUtil.equalsOneIgnoreCase("TWO", dest));
    System.out.println(StringUtil.equalsOneIgnoreCase("tHRee", dest));
    System.out.println(StringUtil.equalsOneIgnoreCase("six", dest));
  }

}
   

It gives the following output,
0
1
2
-1


                    Print

   



Books Recommendation

 
 
bl  br