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

 

amjadm@miamioh.edu > substring
prev  |  next  |  chance

Given a string str, two int values, and a boolean value, write a method that works similar to the String.substring method if the given boolean value is true. e.g. substring("hello!", 0, 2, true) --> "he". If the boolean value is false, return a new string starting from the first given int value all the way to the end of the string. e.g. substring("hello!", 0, 2, false) --> "hello!".


substring("abc", 0, 1, true) → "a"
substring("Hello", 0, 4, true) → "Hell"
substring("a", 0, 0, true) → ""

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

public String substring(String str, int start, int end, boolean check) { }

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: 100 Post-solution available

Copyright Nick Parlante 2017 - privacy