Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;

public class Main {
    public static String limitMessage(String str, int limit) {
        if (str.length() <= limit) {
            return str;
        } else {
            StringBuilder sb = new StringBuilder(str.substring(0, limit));
            sb.append("...");
            return sb.toString();
        }

    }
}