Here you can find the source of substringEnd(String string, int start, int length)
Parameter | Description |
---|---|
string | The string |
start | The start index |
length | The length |
public static String substringEnd(String string, int start, int length)
//package com.java2s; //License from project: Open Source License public class Main { /**/*from w ww. ja v a2 s.com*/ * Substrings the string using start index and * length, that defines the number of characters * in the substringed string. The end index is * as following: <code>end = start + length</code>. * @param string The string * @param start The start index * @param length The length * @return The substringed string*/ public static String substringEnd(String string, int start, int length) { return string.substring(start, Math.max(start, string.length() - Math.min(start + length, string.length()))); } }