Android String Cut cutString(String source, int slength)

Here you can find the source of cutString(String source, int slength)

Description

cut String

Declaration

public static String cutString(String source, int slength) 

Method Source Code

//package com.java2s;

public class Main {

    public static String cutString(String source, String output, int slength) {
        String returnVal = null;/*from  w  ww  . j  a v a2 s  .co  m*/
        if (source != null) {
            if (source.length() > slength) {
                returnVal = source.substring(0, slength) + output;
            } else
                returnVal = source;
        }
        return returnVal;
    }

    public static String cutString(String source, int slength) {
        String result = null;
        if (source != null) {
            if (source.length() > slength) {
                result = source.substring(0, slength);
            } else
                result = source;
        }
        return result;
    }
}

Related

  1. cutString(String source, String output, int slength)
  2. cutText(String text, int maxLength)
  3. safeCut(String str, int length)
  4. safeCutNoDot(String str, int length)
  5. cutString(String str, int length)