Question Index

Write a program to check the given substring is starts at input string in the given index or not.

Input (String, String, int) Output (Boolean)
'Your Online Java School', 'Online', 5 true
'HYDERABAD', 'BAD', 6 true
'Java School', 'School', 4 false
'MeritCampus', 'Campus', 6 false

class IsStartsWithGivenRange
    public static void main(String s[])
        String inputString = "Your Online Java School";
        String subString = "Online";
        int range = 5;
        System.out.println("The range of given input string is substring or not: " + isStartsWith(inputString, subString, range));


    public static boolean isStartsWith(String inputString, String subString, int index) {




Topic: Java String startsWith() And endsWith() Methods

Read this topic
Take test on this topic

Score more than 2 points

© meritcampus 2019

All Rights Reserved.

Open In App