Java String Sub String substring(String input, int expectedLength)

Here you can find the source of substring(String input, int expectedLength)

Description

substring

License

Open Source License

Parameter

Parameter Description
comment a parameter
commentLength a parameter

Declaration

public static String substring(String input, int expectedLength) 

Method Source Code

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

public class Main {
    /**/*from w  ww  .ja  v  a2 s .  c  om*/
     * @param comment
     * @param commentLength
     * @return
     */
    public static String substring(String input, int expectedLength) {
        String output = input;

        if (input != null && input.length() > expectedLength) {
            output = input.substring(0, expectedLength);
        }

        return output;
    }
}

Related

  1. substring(final String string, int fromIndex, int toIndex)
  2. substring(final String text, final int position, final int length)
  3. substring(String _text, int _idx)
  4. substring(String baseString, int start, int end)
  5. subString(String input, char start, char end)
  6. substring(String input, int maxLength)
  7. substring(String input, int maxLength)
  8. subString(String input, String startStr, String endStr)
  9. subString(String name)