Example usage for java.lang String substring

List of usage examples for java.lang String substring

Introduction

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

Prototype

public String substring(int beginIndex, int endIndex) 

Source Link

Document

Returns a string that is a substring of this string.

Usage

From source file:Main.java

public static String convertGMTToLoacale(String gmt) {
    String s1 = gmt.substring(0, 10);
    String s2 = gmt.substring(11, 19);
    return s1 + " " + s2;
}

From source file:Main.java

private static String captitalize(String propertyName) {
    return propertyName.substring(0, 1).toUpperCase() + propertyName.substring(1);
}

From source file:Main.java

/**
 * Capitalizes the first letter of the string and converts '_' to ' '.
 *
 * That is, where the name is "field_name", this will return "Field name".
 *///from ww w .  j ava  2s  .c o m
private static String formatFieldName(String name) {
    return name.substring(0, 1).toUpperCase(Locale.US) + name.substring(1).replace('_', ' ').trim();
}

From source file:Main.java

public static String[] splitArrayString(String string) {
    String ss = string.substring(1, string.length() - 1);
    return ss.split("\\,");
}

From source file:Main.java

private static float fromHex(String s, int idx) {
    s = s.substring(idx, idx + 2);//
    int i = Integer.parseInt(s, 16);
    float rt = ((float) i) / 255f;
    return rt;// w  ww.j a v a  2 s .c  om
}

From source file:Main.java

public static String getDirPath(String filePath) {

    return filePath.substring(0, filePath.lastIndexOf(File.separator));
}

From source file:Main.java

private static String getReadMethod(String name) {
    return "get" + name.substring(0, 1).toUpperCase(Locale.ENGLISH) + name.substring(1);
}

From source file:Main.java

public static String getClassName(String classMethodName) {
    return classMethodName.substring(0, classMethodName.indexOf('#'));
}

From source file:Main.java

public static int parseTime(String time) {
    String substr = time.substring(0, 2);
    return Integer.parseInt(substr);
}

From source file:Main.java

public static String getSplitNewsId(String newsid) {
    String s1 = newsid.substring(0, 3);
    String s2 = newsid.substring(3);
    return s1 + "/" + s2;
}