id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

orion.a.smith@gmail.com hcs-strings > hcsStringsFirstFiveSearch
prev  |  next  |  chance

Given two String inputs, return the position of the first five characters of the first String within the second String, or -1 if the first five characters of the first String do not occur within the second String. Note that some of the input Strings will have less than five characters, return -1 if that happens.


hcsStringsFirstFiveSearch("abcdefg", "abcde Blah blah") → 0
hcsStringsFirstFiveSearch("abcdefg", "Blah blah abcde") → 10
hcsStringsFirstFiveSearch("abc", "abc") → -1

...Save, Compile, Run (ctrl-enter)

public int hcsStringsFirstFiveSearch(String one, String two) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 150 Post-solution available

Copyright Nick Parlante 2017 - privacy