Example usage for java.lang CharSequence equals

List of usage examples for java.lang CharSequence equals

Introduction

In this page you can find the example usage for java.lang CharSequence equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Indicates whether some other object is "equal to" this one.

Usage

From source file:Main.java

private static boolean isNullOrEmpty(final CharSequence s) {

    return (s == null || s.equals("") || s.equals("null") || s.equals("NULL"));
}

From source file:Main.java

/**
 * @param s/* w ww.java2s  . c  om*/
 * @return Boolean type
 */
public static boolean isNullOrEmpty(final CharSequence s) {
    return (s == null || s.equals("") || s.equals("null") || s.equals("NULL"));
}

From source file:Main.java

public static CharSequence toLowerCase(CharSequence character) {
    if (character == null || character.equals("")) {
        return character;
    }//from  w ww .  j  a  va  2  s .c o  m
    StringBuffer buffer = new StringBuffer();
    for (int i = 0; i < character.length(); i++) {
        buffer.append(Character.toLowerCase(character.charAt(i)));
    }
    return buffer.toString();
}

From source file:Main.java

public static boolean convertValueToBoolean(CharSequence value, boolean defaultValue) {
    if (value == null)
        return defaultValue;

    return value.equals("1") || value.equals("true") || value.equals("TRUE");
}

From source file:Main.java

/**
 * Append newText to the text field represented by connection.
 * The new text becomes selected./*from   www  .  ja  v  a2 s  .  c  o  m*/
 */
public static void appendText(InputConnection connection, String newText) {
    if (connection == null) {
        return;
    }

    // Commit the composing text
    connection.finishComposingText();

    // Add a space if the field already has text.
    CharSequence charBeforeCursor = connection.getTextBeforeCursor(1, 0);
    if (charBeforeCursor != null && !charBeforeCursor.equals(" ") && (charBeforeCursor.length() > 0)) {
        newText = " " + newText;
    }

    connection.setComposingText(newText, 1);
}

From source file:Main.java

public static final boolean convertValueToBoolean(CharSequence value, boolean defaultValue) {
    boolean result = false;

    if (null == value)
        return defaultValue;

    if (value.equals("1") || value.equals("true") || value.equals("TRUE"))
        result = true;/*w w w. j a v  a  2  s .c om*/

    return result;
}

From source file:Main.java

public static final int convertValueToList(CharSequence value, String[] options, int defaultValue) {
    if (null != value) {
        for (int i = 0; i < options.length; i++) {
            if (value.equals(options[i]))
                return i;
        }//  w  w w. j  av a  2s .c om
    }

    return defaultValue;
}

From source file:Main.java

public static final int convertValueToList(CharSequence value, String[] options, int defaultValue) {
    if (null != value) {
        for (int i = 0; i < options.length; i++) {
            if (value.equals(options[i])) {
                return i;
            }//from  w  w  w  .  j a  v  a  2 s  .  c  o  m
        }
    }

    return defaultValue;
}

From source file:Main.java

public static int convertValueToList(CharSequence value, String[] options, int defaultValue) {
    if (value != null)
        for (int i = 0; i < options.length; i++)
            if (value.equals(options[i]))
                return i;
    return defaultValue;
}

From source file:Main.java

public static final boolean convertValueToBoolean(CharSequence value, boolean defaultValue) {
    boolean result = false;

    if (null == value) {
        return defaultValue;
    }//from   ww  w  . j  a v a 2 s  .com

    if (value.equals("1") || value.equals("true") || value.equals("TRUE")) {
        result = true;
    }

    return result;
}