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 getStringPreview(String str) {
        String preview;
        if (str.length() < 29) {
            preview = str.replace("\n", " ");
        } else {
            preview = str.replace("\n", " ").substring(0, 29) + "...";
        }
        return preview;
    }
}