Java Message Format format(String activity, Object item, Long count, Long total)

Here you can find the source of format(String activity, Object item, Long count, Long total)

Description

format

License

Open Source License

Declaration

public static String format(String activity, Object item, Long count, Long total) 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.text.MessageFormat;

public class Main {
    public static String format(String activity, Object item, Long count, Long total) {
        String msg;/* w ww  .j  a va  2 s .  c o  m*/

        if (count != null) {
            if (total != null) {
                msg = MessageFormat.format("{0} {1} ({2} of {3})", activity, item, count, total);
            } else {
                msg = MessageFormat.format("{0} {1} ({2})", activity, item, count);
            }
        } else {
            msg = MessageFormat.format("{0} {1}", activity, item);
        }
        return msg;
    }
}

Related

  1. format(final String message, final Object... args)
  2. format(final String template, final Object... arguments)
  3. format(ResourceBundle bundle, String key, Object... args)
  4. format(String key, Object... values)
  5. format(String message, Object argument)
  6. format(String message, Object object)
  7. format(String message, Object parameter)