Example usage for java.lang String toString

List of usage examples for java.lang String toString

Introduction

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

Prototype

public String toString() 

Source Link

Document

This object (which is already a string!) is itself returned.

Usage

From source file:Main.java

public static Boolean EmailCheck(String str) {

    if (str.toString().length() > 0 && !str.matches("^\\w+@\\w+\\.(com|cn)")) {
        return false;

    } else//from w w w.  j  av  a2 s .  com
        return true;
}

From source file:Main.java

public static String getStartTag(String tagName) {
    return "<" + tagName.toString() + ">";
}

From source file:Main.java

public static String getEndTag(String tagName) {
    return "</" + tagName.toString() + ">";
}

From source file:Main.java

public static int getFirstHighOperatorIndex(String text) {
    int div_index = text.toString().indexOf('/');
    int mult_index = text.toString().indexOf('*');

    return (mult_index <= div_index) ? mult_index : div_index;
}

From source file:Main.java

public static int getFirstLowOperatorIndex(String text) {
    int add_index = text.toString().indexOf('+');
    int sub_index = text.toString().indexOf('-');

    return (add_index <= sub_index) ? add_index : sub_index;
}

From source file:Main.java

public static String[] getXyValuesFromCoords(String currentCoords) {
    String[] coords = currentCoords.toString().split(",\\s*");
    return coords;
}

From source file:Main.java

protected static int parseVersionPart(String partStr) {
    partStr = partStr.toString();
    int len = partStr.length();
    int number = 0;
    for (int i = 0; i < len; ++i) {
        char c = partStr.charAt(i);
        if (c > '9' || c < '0')
            break;
        number = (number * 10) + (c - '0');
    }//w w w  . j a  v  a2  s.  co m
    return number;
}

From source file:Main.java

public static String getTelephonyMgr(Context context) {
    TelephonyManager tm = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
    String imei = tm.getDeviceId();
    return imei.toString();
}

From source file:Main.java

public static String getCacheKeyForId(String id, Class<?> clazz) {
    return clazz.getSimpleName() + "_" + id.toString();
}

From source file:Main.java

public static double doubleFromString(String s) {
    try {//from w ww  .j  av  a  2s.c o  m
        double val = Double.valueOf(s.toString().replace(",", ""));
        return val;
    } catch (NumberFormatException e) {

    }
    return 0;
}