tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 
 Tools and Libs > Ostermiller Utilities > String Contains any Ignorecase

String Contains any Ignorecase 

Ostermiller Java Utilities contain various components such as CSV parsing, Base64 Encoding, MD5 digest, String and Exec Helper classes. This requires the library ostermillerutils-1.08.01.jar to be in classpath. The following example shows using StringHelper.containsAnyIgnoreCase() API. It returns TRUE if the given string contains any of the given terms irrespective of the case.

File Name  :  
com/bethecoder/tutorials/ostermillerutils/StringContainsAnyIgnorecaseTest.java 
Author  :  Sudhakar KV
Email  :  kvenkatasudhakar@gmail.com
   
package com.bethecoder.tutorials.ostermillerutils;

import java.io.IOException;

import com.Ostermiller.util.StringHelper;

public class StringContainsAnyIgnorecaseTest {

  /**
   @param args
   @throws IOException 
   */
  public static void main(String[] argsthrows IOException {

    String str = "be the coder";
    String [] termsToFind = new String [] { "CO""A""XYZ" };
    System.out.println(StringHelper.containsAnyIgnoreCase(str, termsToFind));
    
    termsToFind = new String [] { "abc""a""xyz" };
    System.out.println(StringHelper.containsAnyIgnoreCase(str, termsToFind));
  }

}
   

It gives the following output,
true
false


                    Print

   



Books Recommendation

 
 
bl  br