tl  tr
  Home | Tutorials | Articles | Videos | Products | Tools | Search
Open Source | Tag Cloud | Follow Us | Bookmark | Contact   
 
 Tools and Libs > Google Guava > Basic > Char Matcher Is and Is Not

Char Matcher Is and Is Not 

Google Guava is a java library with lot of utilities and reusable components. This requires the library guava-10.0.jar to be in classpath. The following example shows using CharMatcher.is() and CharMatcher.isNot() API.

File Name  :  
com/bethecoder/tutorials/guava/base_tests/CharMatcherIsNotTest.java 
Author  :  Sudhakar KV
Email  :  kvenkatasudhakar@gmail.com
   
package com.bethecoder.tutorials.guava.base_tests;

import com.google.common.base.CharMatcher;

public class CharMatcherIsNotTest {

  /**
   @param args
   */
  public static void main(String[] args) {
    System.out.println(CharMatcher.is('A').matches('A'));
    System.out.println(CharMatcher.is('A').matches('a'));
    
    System.out.println(CharMatcher.isNot('A').matches('a'));
    System.out.println(CharMatcher.isNot('A').matches('9'));
    System.out.println(CharMatcher.isNot('A').matches('#'));
    System.out.println(CharMatcher.isNot('A').matches('A'));
  }
}
   

It gives the following output,
true
false

true
true
true
false


                    Print

   



Books Recommendation

 
 
bl  br