string.substring(start,length); Returns the portion of string specified by the start and length parameters.
/** * @author lautturi.com * Java example: Return part of a string */ import java.util.*; public class Lautturi { public static void main(String[] args) { String str = "hello lautturi java world!"; System.out.println(str.substring(1,20)); } }
output:
ello lautturi java