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

 

abraskin@mbusd.org 2019_unit2_practice > strLim
prev  |  next  |  chance

An online system limits user entries to n characters. Given a user entry, return it unchanged if its length is less than or equal to n but if it is longer then only return the first 19 characters and put an "*" on the end to show it has been shortened.


strLim("0123456789", 4) → "012*"
strLim("0123456789", 9) → "01234567*"
strLim("0123456789", 10) → "0123456789"

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

public String strLim(String entry, int n) { }

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

Copyright Nick Parlante 2017 - privacy