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

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

From source file:Main.java

/**
 * Sees if the column component is relative or not
 *
 * @param s/* ww  w.java2  s  .c  o  m*/
 * @return TRUE if the column is relative, FALSE otherwise
 */
public static boolean isColumnRelative(String s) {
    return s.charAt(0) != fixedInd;
}

From source file:Main.java

public static int parseHexColor(String color) {
    try {/*from ww  w  .j  av a 2s.  co m*/
        if (color.charAt(0) == '#')
            color = color.substring(1);
        return 0xff000000 | (0x00ffffff & Integer.parseInt(color, 16));
    } catch (Throwable ex) {
        return 0;
    }
}

From source file:Main.java

public static String helpCall(String number) {
    String num;//from ww  w. j  a v  a2  s  . c  o m
    if (number.charAt(0) == '+')
        num = number.substring(1, number.length());
    else
        num = "";
    return num;
}

From source file:Main.java

static int dateParseMonth(String date) {
    int ret = 0;/*w ww  .j  a v a2 s.  c  om*/
    if (date.charAt(5) == '1')
        ret += 10;
    char ch = date.charAt(6);
    if (ch >= '0' && ch <= '9')
        ret += (ch - '0');
    return (ret > 0) ? ret - 1 : 0;
}

From source file:Main.java

public static String upperFirst(String str) {
    return Character.toUpperCase(str.charAt(0)) + str.substring(1);
}

From source file:Main.java

public static boolean containsOnlyNumbers(String str) {
    for (int i = 0; i < str.length(); i++) {
        if (!Character.isDigit(str.charAt(i)))
            return false;
    }//from  w  ww .  ja  v a2  s  . co  m
    return true;
}

From source file:Main.java

static void extractWords(String target, BreakIterator wordIterator) {
    wordIterator.setText(target);//from  w  w w. j  av  a2s .com
    int start = wordIterator.first();
    int end = wordIterator.next();

    while (end != BreakIterator.DONE) {
        String word = target.substring(start, end);
        if (Character.isLetterOrDigit(word.charAt(0))) {
            System.out.println(word);
        }
        start = end;
        end = wordIterator.next();
    }
}

From source file:Main.java

public static String Splitme(String str) {
    if (str != null && str.length() > 0 && str.charAt(str.length() - 1) == ',') {
        str = str.substring(0, str.length() - 1);
    }/*  ww w  . ja va  2s . co m*/
    return str;
}

From source file:Main.java

static int dateParseDay(String date) {
    int ret = 0;//from   w ww  .  j  a  va 2 s .  c  o  m
    char ch = date.charAt(8);
    if (ch >= '1' && ch <= '3')
        ret += 10 * (ch - '0');
    ch = date.charAt(9);
    if (ch >= '1' && ch <= '9')
        ret += (ch - '0');
    return (ret > 0) ? ret : 0;
}