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

 

jebbert@volusia.k12.fl.us > test2020_10_01_APP1SLHL_splitFirst
prev  |  next  |  chance

Write a method that accepts a string parameter and then returns that string with a dash "-" added between the first and second characters. As a precondition, you may assume the input parameter will have at least two character. Look at the test data for examples.


test2020_10_01_APP1SLHL_splitFirst("R2-D2") → "R-2-D2"
test2020_10_01_APP1SLHL_splitFirst("Dr. Who") → "D-r. Who"
test2020_10_01_APP1SLHL_splitFirst("Star Trecking, across the universe...") → "S-tar Trecking, across the universe..."

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

public String test2020_10_01_APP1SLHL_splitFirst(String str) { }

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

Copyright Nick Parlante 2017 - privacy