Writing a word-wrapping algorithm is one of the things were you may assume it takes an hour or two to solve... and then a week later you're still hunting edge cases in your code.

Found a slick way to write one? Show me your code! 😊

Follow

@fribbledom You can tokenize the sentences with a scanner. Then it becomes a very simple problem and you can easily lay them out to a fixed width.

Β· Β· Amaroq Β· 0 Β· 0 Β· 0
Sign in to participate in the conversation
Mastodon πŸ” privacytools.io

Fast, secure and up-to-date instance. PrivacyTools provides knowledge and tools to protect your privacy against global mass surveillance.

Website: privacytools.io
Matrix Chat: chat.privacytools.io
Support us on OpenCollective, many contributions are tax deductible!