Android String Shorten truncateString(String resource, String startTag, String endTag)

Here you can find the source of truncateString(String resource, String startTag, String endTag)

Description

truncate String

Declaration

public static String truncateString(String resource, String startTag,
        String endTag) 

Method Source Code

//package com.java2s;

public class Main {

    public static String truncateString(String resource, String startTag,
            String endTag) {//from  w w w .  j ava  2  s. c om
        int start = resource.indexOf(startTag);
        int end = resource.indexOf(endTag, start + startTag.length());
        if (start != -1 && end != -1) {
            resource = resource.substring(start + startTag.length(), end);
            return resource;
        }
        return null;
    }
}

Related

  1. addEllipsis(String src, String ellipsis, int maxLength)
  2. toLength(String str, int length)
  3. truncate(String text, int length)
  4. truncateAt(String string, int length)
  5. curtail(String str, int size, String tail)
  6. truncateAtMaxLength(String source, int maxLength, boolean addEllipsis)
  7. shortenString(String str, int length)
  8. ellipsizeString(String string, int limit)
  9. ellipsize(final String text, final int length)