CompSci 251: Intermediate Computer Programming Lab 11 Solution




In this lab, you will be asking the user for the name of an input file and the name of an output file.  You will read the input file, modify each line, and write each modified line to the output file. Each line of the input file should be in the form <str>:<i>:<j>. For each line, you should take the substring of str between indices i and j. Assume the lines will always be entered is this form and i and j will always be numbers. You must make sure i and j are valid indices of str and i <= j. You may use any String methods you wish.  You will need to use Integer.parseInt().

Input file examplestring:0:5


examplestring:2:7 examplestring:7:2 examplestring:45:78

Output file examp

xampl ample

i > j, invalid indices.

i or j are larger than string length.

error: Content is protected !!