5 kyu

Arbitrary word wrapping

357 of 358scrabbledude

Description:

You are writing an app that displays a fixed width font and has a strict limit of 25 characters per line in one particular text area.

Write a function that takes in a string, inserts newline characters, and adds a hyphen on the end of a line if a word is continued on the next line.

White space should be left in the result string as is.

Strings
Algorithms

Stats:

CreatedJul 18, 2013
PublishedJul 20, 2013
Warriors Trained946
Total Skips201
Total Code Submissions7058
Total Times Completed358
JavaScript Completions357
Total Stars13
% of votes with a positive feedback rating76% of 99
Total "Very Satisfied" Votes67
Total "Somewhat Satisfied" Votes16
Total "Not Satisfied" Votes16
Ad
Contributors
  • scrabbledude Avatar
  • jhoffner Avatar
  • flaco Avatar
Ad