Java String Truncate truncateAndTrim0(String str, String delim)

Here you can find the source of truncateAndTrim0(String str, String delim)

Description

truncate And Trim

License

Open Source License

Declaration

public static String truncateAndTrim0(String str, String delim) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String truncateAndTrim0(String str, String delim) {
        if (str == null || delim == null) {
            return str;
        }// ww  w . ja  v a  2s  . c  o  m
        int nStart = str.indexOf(delim);
        if (nStart < 0) {
            return str;
        }
        return str.substring(0, nStart);
    }
}

Related

  1. truncate(String value, int length)
  2. truncate(String value, int length)
  3. truncate(String value, int maxLen, String ellipses)
  4. truncate(String x, int length)
  5. truncateAndTrailOffText(String text, int limit)
  6. truncateAt(final String input, final String... substrings)
  7. truncateAt(String str, char chr)
  8. truncateAtMaxLength(String source, int maxLength, boolean addEllipsis)
  9. truncateAtWhitespace(String text, int length)