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 getUsernameShow(String long_username) {
    String userOwner = long_username;
    return userOwner.substring(0, long_username.indexOf("@"));
}

From source file:Main.java

public static String capitalized(@NonNull final String string) {
    return string.substring(0, 1).toUpperCase() + string.substring(1);
}

From source file:Main.java

public static String parseAction(String action) {
    return (action.substring(action.indexOf(':') + 1, action.length())).trim();
}

From source file:Main.java

public static String getResourceURL(String sxURL, String resource) {
    return sxURL.substring(0, sxURL.lastIndexOf("/")) + resource;
}

From source file:Main.java

public static String singlechou(long time) {
    String timechou = time + "";
    timechou = timechou.substring(0, timechou.length() - 3);
    return timechou;
}

From source file:Main.java

public static String toIPAddress(String ip) {
    return "" + Integer.parseInt(ip.substring(0, 3)) + "." + Integer.parseInt(ip.substring(3, 6)) + "."
            + Integer.parseInt(ip.substring(6, 9)) + "." + Integer.parseInt(ip.substring(9, 12));
}

From source file:Main.java

public static String getFileDir(String filePath) {
    return filePath.substring(0, filePath.lastIndexOf(File.separator));
}

From source file:Main.java

public static String capitalizeFirstLetter(String word) {
    return word.substring(0, 1).toUpperCase() + word.substring(1);
}

From source file:Main.java

public static String getShortName(String name) {
    return (name.length() > 25) ? name.substring(0, 25) + "..." : name;
}

From source file:Main.java

public static String formatUsername(String in) {
    try {//  w  w  w.j a va  2s .  c o m
        in = in.substring(0, 1).toUpperCase() + in.substring(1, in.length()).toLowerCase();
    } catch (IndexOutOfBoundsException ex) {
    }
    return in;
}