”;
Enumeration of IO case sensitivity. Different Operating systems have different rules for case-sensitivity for file names. For example, Windows is case-insensitive for file naming while Unix is case-sensitive. IOCase captures that difference, provides an enumeration to control how filename comparisons should be performed. It also provides methods to use the enumeration to perform comparisons.
Enum Declaration
Following is the declaration for org.apache.commons.io.IOCase Enum −
public enum IOCase extends Enum<IOCase> implements Serializable
Example of IOCase Enum
An example of IOCase Enum is given below −
IOTester.java
import java.io.IOException; import org.apache.commons.io.IOCase; public class IOTester { public static void main(String[] args) { try { usingIOCase(); } catch(IOException e) { System.out.println(e.getMessage()); } } public static void usingIOCase() throws IOException { String text = "Welcome to TutorialsPoint. Simply Easy Learning."; String text1 = "WELCOME TO TUTORIALSPOINT. SIMPLY EASY LEARNING."; System.out.println("Ends with Learning (case sensitive): " + IOCase.SENSITIVE.checkEndsWith(text1, "Learning.")); System.out.println("Ends with Learning (case insensitive): " + IOCase.INSENSITIVE.checkEndsWith(text1, "Learning.")); System.out.println("Equality Check (case sensitive): " + IOCase.SENSITIVE.checkEquals(text, text1)); System.out.println("Equality Check (case insensitive): " + IOCase.INSENSITIVE.checkEquals(text, text1)); } }
Output
It will print the following result −
Ends with Learning (case sensitive): false Ends with Learning (case insensitive): true Equality Check (case sensitive): false Equality Check (case insensitive): true
Advertisements
”;