C# Class Crisis.StringFormatter.OptimalWordWrappedString

Class performing an "optimal solution" word wrapping creating a somewhat more estetically pleasing layout.

This is based on the "optimal solution" as described on the Wikipedia page for "Word Wrap" (http://en.wikipedia.org/wiki/Word_wrap). The drawback of this method compared to the simple "greedy" technique is that this is much, much slower. However for short strings to print as console messages this will not be a problem, but using it in a WYSIWYG word processor is probably not a very good idea.

ファイルを表示 Open project: teeknofil/Crisis-Wordlist-Generator

Public Methods

Method Description
OptimalWordWrappedString ( string s, int lineWidth ) : System
ToString ( ) : string

Private Methods

Method Description
BuildWordList ( string s, int lineWidth ) : void
FindLastOptimalBreak ( int j ) : LineBreakResult
GetCost ( int i, int j ) : int
GetWords ( int i, int j ) : string
SumWidths ( int i, int j ) : int

Method Details

OptimalWordWrappedString() public method

public OptimalWordWrappedString ( string s, int lineWidth ) : System
s string
lineWidth int
return System

ToString() public method

public ToString ( ) : string
return string