C# Класс 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.

Показать файл Открыть проект

Открытые методы

Метод Описание
OptimalWordWrappedString ( string s, int lineWidth ) : System
ToString ( ) : string

Приватные методы

Метод Описание
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

Описание методов

OptimalWordWrappedString() публичный Метод

public OptimalWordWrappedString ( string s, int lineWidth ) : System
s string
lineWidth int
Результат System

ToString() публичный Метод

public ToString ( ) : string
Результат string