Question: The user will be able to give a string and an index position in the string as arguments to the method. The method will return

The user will be able to give a string and an index position in the string as arguments to the method. The method will return the character located at that index position in the string (including white spaces).Complete the method public static char returnTheCharacterAtTheGivenIndex to complete this task Task 3: The user will be able to give a string and an index position in the string as arguments to the method. The method will return the substring starting at that index position in the string (including white spaces) to the end of the string. Complete the method public static String returnTheSubStringStartingAtTheGivenIndex to complete this task. /*
*return the character at the given index in word
*/
public static char returnTheCharacterAtTheGivenIndex(String word, int index){
return '\0';
}
/*
* return the substring starting from the given index
*/
public static String returnTheSubStringStartingAtTheGivenIndex(String word, int index){
return "";
} Please write a code in regex to follow to tasks given and return the answer to a driver. Below are the strings being checked System.out.println(StringRegExAssignment.returnTheCharacterAtTheGivenIndex("1999",2)); //9
System.out.println(StringRegExAssignment.returnTheCharacterAtTheGivenIndex("CSCI1302",0)); //C
System.out.println(StringRegExAssignment.returnTheCharacterAtTheGivenIndex("Chicken Wrap", 7)); // white space
System.out.println(StringRegExAssignment.returnTheSubStringStartingAtTheGivenIndex("1999",2)); //99
System.out.println(StringRegExAssignment.returnTheSubStringStartingAtTheGivenIndex("CSCI1302",0)); //CSCI1302
System.out.println(StringRegExAssignment.returnTheSubStringStartingAtTheGivenIndex("Chicken Wrap", 7)); //(white space)Wrap

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!