Example usage for java.lang String format

List of usage examples for java.lang String format

Introduction

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

Prototype

public static String format(String format, Object... args) 

Source Link

Document

Returns a formatted string using the specified format string and arguments.

Usage

From source file:Main.java

public static String getCompleteStr(String msg) {
    return String.format("%1$-20s", msg);
}

From source file:Main.java

public static String convertNumber(long number) {
    return String.format("%,d", number);
}

From source file:Main.java

public static String intColorToHex(int intColor) {
    return String.format("#%06X", 0xFFFFFF & intColor);
}

From source file:Main.java

public static String getStringFrom(double total) {
    return String.format("%.2f", total);
}

From source file:Main.java

public static String formatLikes(int likesCount) {
    return String.format("%,d likes", likesCount);
}

From source file:Main.java

public static String getPhotoPath(String fileName) {
    return String.format("file:///android_asset/photos/%s.jpg", fileName);
}

From source file:Main.java

public static String hexUnsignedString(byte b) {
    return String.format("%02x", decUnsigned(b));
}

From source file:Main.java

public static String liangweixiaoshu1(String value) {
    return String.format("%.2f", Float.parseFloat(value));
}

From source file:Main.java

public static String decinalFormatUptoTwo(double d) {

    return String.format("%.2f", d);
}

From source file:Main.java

public static String getRealNumberString(double value) {
    return String.format("%.1f", value);
}