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 getFirstLetterCap(String myString) {
    return myString.substring(0, 1).toUpperCase() + myString.substring(1);
}

From source file:Main.java

public static String Stringdelete(String a, int t) {
    return a.substring(0, t);
}

From source file:Main.java

public static String getFileNameWithoutExtension(String fileName) {
    return fileName.substring(0, fileName.lastIndexOf("."));
}

From source file:Main.java

public static String getExtension(String fileName) {
    return fileName.substring(fileName.lastIndexOf(".") + 1, fileName.length());
}

From source file:Main.java

/**
 * To proper case.//  w  w w  .  ja  v a  2  s  .c o  m
 * 
 * @param s
 *            the s
 * @return the string
 */
private static String toProperCase(String s) {
    return s.substring(0, 1).toUpperCase() + s.substring(1).toLowerCase();
}

From source file:Main.java

public static String formatYMDHM(String timeStr) {
    return timeStr.substring(0, 16).replace("-", ".");
}

From source file:Main.java

public static String CarFromString(String carNumber) {
    return carNumber.substring(0, 2);
}

From source file:Main.java

public static String CarNumberString(String carNumber) {
    return carNumber.substring(2, 7);
}

From source file:Main.java

public static String formatMDHM(String timeStr) {
    return timeStr.substring(5, 16).replace("-", ".");
}

From source file:Main.java

private static String removeLastSegment(final String fqcn) {
    return fqcn.substring(0, fqcn.lastIndexOf("."));
}