Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

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

public class Main {

    public static String limitLenOfStr(String str, int maxLen) {

        if (null != str && str.length() > maxLen) {

            StringBuffer sb = new StringBuffer();

            sb.append(str.substring(0, maxLen));
            sb.append("...");

            return sb.toString();
        }

        return str;
    }
}