Java String Truncate truncate(String str, int max)

Here you can find the source of truncate(String str, int max)

Description

truncate

License

Open Source License

Declaration

public static String truncate(String str, int max) 

Method Source Code

//package com.java2s;

public class Main {
    public static String truncate(String str, int max) {
        if (str.length() <= max) {
            return str;
        }// ww w  .  java 2  s.  c o  m
        return str.substring(0, max);
    }
}

Related

  1. truncate(String str, int len)
  2. truncate(String str, int length)
  3. truncate(String str, int length)
  4. truncate(String str, int length)
  5. truncate(String str, int length)
  6. truncate(String str, int max)
  7. truncate(String str, int maxLen)
  8. truncate(String str, int maxSize)
  9. truncate(String str, int maxSize)