format Cashier Id - Android java.lang

Android examples for java.lang:String Format

Description

format Cashier Id

Demo Code

import android.content.Context;
import java.math.BigInteger;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class Main{

    public static String formatCashierId(String cashId) {
        int id = Integer.parseInt(cashId);
        return String.format("%04d", id);
    }/*from w w  w .ja v a 2  s  .com*/

}

Related Tutorials