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 char randomChar(String alphabet) {
    return alphabet.charAt(new Random().nextInt(alphabet.length()));
}

From source file:Main.java

public static String ridQuote(String val) {
    if (val.charAt(0) == '"' && val.charAt(val.length() - 1) == '"') {
        return val.substring(1, val.length() - 1);
    }// w w w . j  av a2 s .  co m
    return val;
}

From source file:Main.java

public static boolean isJavaIdentifier(String s) {
    if (s.length() == 0 || !Character.isJavaIdentifierStart(s.charAt(0))) {
        return false;
    }//  w w  w.j av a2s  .  c o m
    for (int i = 1; i < s.length(); i++) {
        if (!Character.isJavaIdentifierPart(s.charAt(i))) {
            return false;
        }
    }
    return true;
}

From source file:Main.java

private static String getAbsoluteName(String relativePathPrefix, String name) {
    if (name.charAt(0) == '/') {
        return name;
    }//from w w w. j  av a  2 s  .c o m
    return relativePathPrefix + name;
}

From source file:Main.java

public static boolean isEmptyTag(String tagName) {
    return '/' == tagName.charAt(tagName.length() - 1);
}

From source file:Main.java

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

From source file:Main.java

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

From source file:Main.java

private static String analyzeFieldName(String methodName) {
    return String.valueOf(methodName.charAt(3)).toLowerCase() + methodName.substring(4, methodName.length());
}

From source file:Main.java

private static File getFile(String parentPath, String pathName) {
    if (pathName.charAt(0) == File.separatorChar) {
        return new File(pathName);
    }// ww  w.j av a 2  s  . co  m
    return new File(parentPath, pathName);
}

From source file:Main.java

public static String addQuoteMark(String s) {
    if (!TextUtils.isEmpty(s) && s.charAt(0) != '"' && !s.contains("*"))
        s = (new StringBuilder()).append("\"").append(s).append("\"").toString();
    return s;//www . ja v  a  2s .c o m
}