Example usage for java.lang String charAt

List of usage examples for java.lang String charAt

Introduction

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

Prototype

public char charAt(int index) 

Source Link

Document

Returns the char value at the specified index.

Usage

From source file:Main.java

/**
 * Sees if the row component is relative or not
 *
 * @param s/*w ww .  j  a  va2s .  c om*/
 * @return TRUE if the row is relative, FALSE otherwise
 */
public static boolean isRowRelative(String s) {
    return s.charAt(getNumberIndex(s) - 1) != fixedInd;
}

From source file:Main.java

public static String decapitalize(String propertyName) {
    return Character.toLowerCase(propertyName.charAt(0)) + propertyName.substring(1);
}

From source file:Main.java

public static String lowerFirstLetter(String string) {
    if (isEmpty(string) || !Character.isUpperCase(string.charAt(0))) {
        return string;
    }// w w  w.  jav a2  s  .  com
    return String.valueOf((char) (string.charAt(0) + 32)) + string.substring(1);
}

From source file:Main.java

private static String dateFormatHelper(String dayNum) {
    String digit = "";
    if (dayNum.charAt(0) == '0') {
        digit += dayNum.charAt(1);//from w ww  .j  ava2 s  .co m
        return digit + dateFormatHelpersHelper(digit);
    } else
        return dayNum + dateFormatHelpersHelper(dayNum);

}

From source file:Main.java

public static String upperFirstLetter(String string) {
    if (isEmpty(string) || !Character.isLowerCase(string.charAt(0))) {
        return string;
    }/* w  ww.j a  va  2  s .  c  o  m*/
    return String.valueOf((char) (string.charAt(0) - 32)) + string.substring(1);
}

From source file:it.iziozi.iziozi.core.IOApiClient.java

private static String getAbsoluteUrl(String relativeUrl) {
    if (relativeUrl.charAt(0) == '/')
        relativeUrl = relativeUrl.substring(1);
    return BASE_URL + relativeUrl;
}

From source file:Main.java

public static String fixLastSlash(String str) {
    String res = str == null ? "/" : str.trim() + "/";
    if (res.length() > 2 && res.charAt(res.length() - 2) == '/')
        res = res.substring(0, res.length() - 1);
    return res;/* w  w  w  .  j a  v  a  2s . co  m*/
}

From source file:Main.java

public static char getFirstChar(String text) {
    if (text != null && text.length() > 0) {
        return text.charAt(0);
    }/*from ww  w  .  jav  a  2 s  .co m*/
    return (char) 0;
}

From source file:Main.java

public static String IntToExtHex(int val) {
    String sample = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    return new Character(sample.charAt((int) (val / 36))).toString()
            + new Character(sample.charAt(val % 36)).toString();
}

From source file:Main.java

public static String getSSid(Context ctx) {
    WifiManager wm = (WifiManager) ctx.getSystemService(Context.WIFI_SERVICE);
    if (wm != null) {
        WifiInfo wi = wm.getConnectionInfo();
        if (wi != null) {
            String s = wi.getSSID();
            if (s.length() > 2 && s.charAt(0) == '"' && s.charAt(s.length() - 1) == '"') {
                return s.substring(1, s.length() - 1);
            }//w w w  .  ja  va 2 s . com
        }
    }
    return "";
}