Here you can find the source of shorten(String msg, int front, String join, int end)
Parameter | Description |
---|---|
msg | a parameter |
front | a parameter |
join | a parameter |
end | a parameter |
public static String shorten(String msg, int front, String join, int end)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from w w w .j a v a 2 s.c o m*/ * General short string helper. Print max front chars from the beginning, * the join string and max end chars from the end. * @param msg * @param front * @param join * @param end * @return */ public static String shorten(String msg, int front, String join, int end) { if (msg.length() <= (front + join.length() + end)) return msg; return msg.substring(0, front) + join + msg.substring(msg.length() - end); } }