StringUtil.java
Upload User: zghglow
Upload Date: 2022-08-09
Package Size: 27227k
Code Size: 1k
Development Platform:

JavaScript

  1. package com.chinacannel.common;
  2. public class StringUtil {
  3.     public static String getSummaryStr(String str, int length) {
  4.         String sTitle = str; ;
  5.         if (str.length() > length) {
  6.             try {
  7.                 sTitle = str.substring(0, length - 2) + "...";
  8.             } catch (Exception ex) {
  9.                 ex.printStackTrace();
  10.             }
  11.         }
  12.         return sTitle;
  13.     }
  14.     public static String getSummaryStr(String str) {
  15.         return getSummaryStr(str, 16);
  16.     }
  17. }