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

 

concatWithoutFirstLastLetters


public String concatWithoutFirstLastLetters(String a, String b)

Given 2 strings, return the concatentation of the the strings WITHOUT their FIRST and LAST letters.

public String concatWithoutFirstLastLetters(String a, String b) {
  int lenA = a.length();
  int lenB = b.length();
  String aNo1stLast = a.substring(1,lenA-1);
  String bNo1stLast = b.substring(1,lenB-1);
  String combo = aNo1stLast + bNo1stLast;
  return combo;
}

concatWithoutFirstLastLetters("012345", "abcde") → "1234bcd"
concatWithoutFirstLastLetters("Downtown", "Magnets") → "owntowagnet"
concatWithoutFirstLastLetters("United", "States") → "nitetate"

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

public String concatWithoutFirstLastLetters(String a, String b) { }

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

Copyright Nick Parlante 2017 - privacy