id/email
password
forgot password | create account
about | help | prefs
ReadingBatcode reading practice

 

 

String OperationsSubstr4

prev  |  next  |  chance

A slice is inclusive of the starting index and exclusive of the ending index.

public static String slice(String s) {
    return s.substring(0, 2);
}
Function Call  Return Value
slice("Car")
slice("Truck")
slice("556843")
slice("Elephant")
slice("Roses")

Experiment with this code on Gitpod.io

⬅ Back