Example usage for java.lang String equalsIgnoreCase

List of usage examples for java.lang String equalsIgnoreCase

Introduction

In this page you can find the example usage for java.lang String equalsIgnoreCase.

Prototype

public boolean equalsIgnoreCase(String anotherString) 

Source Link

Document

Compares this String to another String , ignoring case considerations.

Usage

From source file:org.duracloud.account.db.util.DbUtilDriver.java

public static void main(String[] args) throws IOException {
    if (args.length != 2) {
        usage("Two arguments are required, you supplied: " + args.length);
        System.exit(1);//  w w w.j a v  a2s  . com
    }

    DbUtil.COMMAND command = null;
    String commandArg = args[0];
    if (commandArg.equalsIgnoreCase(DbUtil.COMMAND.PUT.name())) {
        command = DbUtil.COMMAND.PUT;
    } else {
        usage("The first argument must PUT. " + "The previously supported command GET and CLEAR "
                + "have been removed since the move to MC 2.0.0 " + "You supplied: " + commandArg);
        System.exit(1);
    }

    File workDir = new File(args[1]);
    if (!workDir.exists()) {
        usage("The work directory must exist: " + workDir.getPath());
        System.exit(1);
    } else if (!workDir.isDirectory()) {
        usage("The work directory must be a directory: " + workDir.getPath());
        System.exit(1);
    }

    ApplicationContext context = new ClassPathXmlApplicationContext("jpa-config.xml");
    DuracloudRepoMgr repoMgr = context.getBean("repoMgr", DuracloudRepoMgr.class);

    DbUtil dbUtil = new DbUtil(repoMgr, workDir);
    dbUtil.runCommand(command);
}

From source file:com.rover12421.shaka.cli.Main.java

public static void main(String[] args) throws Exception {
    boolean smali = false;
    boolean baksmali = false;

    String[] realyArgs = args;//w  w  w.j a  v a  2s  .c o m

    if (args.length > 0) {
        String cmd = args[0];
        if (cmd.equalsIgnoreCase("s") || cmd.equalsIgnoreCase("smali")) {
            smali = true;
        } else if (cmd.equalsIgnoreCase("bs") || cmd.equalsIgnoreCase("baksmali")) {
            baksmali = true;
        }

        if (smali || baksmali) {
            realyArgs = new String[args.length - 1];
            System.arraycopy(args, 1, realyArgs, 0, realyArgs.length);
        }
    }

    // cli parser
    CommandLineParser parser = new IgnoreUnkownArgsPosixParser();
    CommandLine commandLine;

    Option language = CommandLineArgEnum.LANGUAGE.getOption();

    Options options = new Options();
    options.addOption(language);

    try {
        commandLine = parser.parse(options, args, false);
        if (CommandLineArgEnum.LANGUAGE.hasMatch(commandLine)) {
            String lngStr = commandLine.getOptionValue(CommandLineArgEnum.LANGUAGE.getOpt());
            Locale locale = Locale.forLanguageTag(lngStr);
            if (locale.toString().isEmpty()) {
                lngStr = lngStr.replaceAll("_", "-");
                locale = Locale.forLanguageTag(lngStr);
            }
            MultiLanguageSupport.getInstance().setLang(locale);
        }
    } catch (Exception ex) {
    }

    if (smali) {
        smaliMainAj.setHookMain(ApktoolMainAj.getHookMain());
        org.jf.smali.main.main(realyArgs);
    } else if (baksmali) {
        baksmaliMainAj.setHookMain(ApktoolMainAj.getHookMain());
        org.jf.baksmali.main.main(realyArgs);
    } else {
        brut.apktool.Main.main(realyArgs);
    }
}

From source file:Main.java

public static void main(String[] args) throws Exception {
    Socket socket = new Socket("localhost", 12900);
    System.out.println("Started client  socket at " + socket.getLocalSocketAddress());
    BufferedReader socketReader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
    BufferedWriter socketWriter = new BufferedWriter(new OutputStreamWriter(socket.getOutputStream()));
    BufferedReader consoleReader = new BufferedReader(new InputStreamReader(System.in));

    String promptMsg = "Please enter a  message  (Bye  to quit):";
    String outMsg = null;

    System.out.print(promptMsg);//www.  j  av  a 2s. co m
    while ((outMsg = consoleReader.readLine()) != null) {
        if (outMsg.equalsIgnoreCase("bye")) {
            break;
        }
        // Add a new line to the message to the server,
        // because the server reads one line at a time.
        socketWriter.write(outMsg);
        socketWriter.write("\n");
        socketWriter.flush();

        // Read and display the message from the server
        String inMsg = socketReader.readLine();
        System.out.println("Server: " + inMsg);
        System.out.println(); // Print a blank line
        System.out.print(promptMsg);
    }
    socket.close();
}

From source file:NameLister.java

public static void main(String args[]) {

    if (args.length != 1) {
        System.err.println("Usage: java NameLister xmlfile.xml");
        System.exit(-1);/*from ww  w .j  a v a 2 s  .co  m*/
    }

    try {

        SAXParserFactory factory = SAXParserFactory.newInstance();
        SAXParser saxParser = factory.newSAXParser();

        DefaultHandler handler = new DefaultHandler() {
            boolean name = false;

            public void startElement(String uri, String localName, String qName, Attributes attributes)
                    throws SAXException {
                if (qName.equalsIgnoreCase("NAME")) {
                    name = true;
                }
            }

            public void characters(char ch[], int start, int length) throws SAXException {
                if (name) {
                    System.out.println("Name: " + new String(ch, start, length));
                    name = false;
                }
            }
        };

        saxParser.parse(args[0], handler);

    } catch (Exception e) {
        e.printStackTrace();
    }
}

From source file:Main.java

public static void main(String[] args) throws IOException {
    BufferedReader br = new BufferedReader(new InputStreamReader(System.in));

    String text = "q";
    while (true) {
        System.out.print("Please type a message (Q/q to quit) and press enter:");
        text = br.readLine();//w ww .j  a  va  2  s .com
        if (text.equalsIgnoreCase("q")) {
            System.out.println("We have  decided to exit  the   program");
            break;
        } else {
            System.out.println("We typed: " + text);
        }
    }
}

From source file:com.jointhegrid.ironcount.user.IroncountCli.java

public static void main(String[] args) throws Exception {
    properties = System.getProperties();
    if (properties.get(WorkloadManager.ZK_SERVER_LIST) == null) {
        logger.warn(WorkloadManager.ZK_SERVER_LIST + " was not defined setting to localhost:2181");
        properties.setProperty(WorkloadManager.ZK_SERVER_LIST, "localhost:2181");
    }// ww  w. java 2 s.com
    workloadManager = new WorkloadManager(properties);
    // TODO parse & apply parameters from CLI
    // TODO push through config properties file
    IroncountCli ic = new IroncountCli();

    //ic.doExecute();

    logger.warn("starting console reader");
    ConsoleReader reader = new ConsoleReader();

    String line;
    while ((line = reader.readLine("[ironcount] ")) != null) {
        if (line.equalsIgnoreCase("exit")) {
            System.exit(0);
        } else if (line.equalsIgnoreCase("stop")) {
            reader.printString("Stopping ironcount workload manager...");
            workloadManager.shutdown();
            reader.printString("Stopped. \n");
        } else if (line.equalsIgnoreCase("start")) {
            reader.printString("Starting ironcount workload manager...");
            workloadManager.init();
            reader.printString("OK \n");
        }
        processArgs(line.split(" "), reader);
    }
}

From source file:Main.java

public static void main(String[] argv) throws Exception {
    String s1 = "a";
    String s2 = "A";
    String s3 = "B";

    // Check if identical
    boolean b = s1.equals(s2); // false

    // Check if identical ignoring case
    b = s1.equalsIgnoreCase(s2); // true

}

From source file:Main.java

public static void main(String[] args) {
    String str1 = new String("JAVA");
    String str2 = new String("java");

    System.out.println(str1.equals("JAVA"));

    System.out.println(str1.equals(str2));

    System.out.println(str1.equalsIgnoreCase(str2));
}

From source file:Main.java

public static void main(String[] args) {
    Scanner input = new Scanner(System.in);
    String confirm = "y";

    do {/*from www.j  a  v a 2s  .  c  o m*/
        System.out.println("Welcome to Java Programming!");
        System.out.println("Print Again? (y/n)");
        confirm = input.nextLine();
    } while (confirm.equalsIgnoreCase("y"));
}

From source file:MainClass.java

public static void main(String[] args) {
    int number = 2;
    String input;

    while (true) {
        System.out.println(number + " ");
        System.out.print("Do you want to keep counting?" + " (Y or N)");
        input = sc.next();/*from  w ww  . j a v  a  2s  .  c o  m*/
        if (input.equalsIgnoreCase("N"))
            break;
        number += 2;
    }
}