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

 

frew@mclean.com unit5day1 > partOfPhrase
prev  |  next  |  chance

Write a method named partOfPhrase that accepts a String phrase and a character stop as parameters. The method returns the characters in the String till it encounters the character stop. For example, the call partOfPhrase ("We are painting", 'p') should return "We are " and partOfPhrase ("We are talking", 'p') should return "We are talking". The call partOfPhrase ("",'p') should return the empty string "".


partOfPhrase("We are painting", "p") → "We are "
partOfPhrase("We are talking", "p") → "We are talking"
partOfPhrase("", "p") → ""

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

public String partOfPhrase(String phrase, char stop) { }

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: 200

Copyright Nick Parlante 2017 - privacy