about | help | code help+videos | done | prefs |
Write a method that accepts two string input parameters. 'orig' is the original string and 'sub' is the substring to find in the original string. Return the LAST occurance of 'sub' within 'orig' or if 'sub' does not occur in 'orig' return -1. Note that 'sub' will NOT be longer than 'orig' and neither string will be empty. You may only use the following string methods in solving this problem: .length .substring .equals .charAt locateSubStr123("Run for the hills, run for your life!", "o") → 28 locateSubStr123("I cannot understand why this would be difficult", "I") → 0 locateSubStr123("This is a test to see what is right", "is") → 27 ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 280
Copyright Nick Parlante 2017 - privacy