Skip to content

M_CommandLine_Text_TextWrapper_AddWordToLastLineOrCreateNewLineIfNecessary

Moh.Hassan edited this page Oct 10, 2019 · 1 revision

TextWrapper.AddWordToLastLineOrCreateNewLineIfNecessary Method

When presented with a word, either append to the last line in the list or start a new line

Namespace:CommandLine.Text
Assembly: CommandLine (in CommandLine.dll) Version: 0.0.0

Syntax

C#

privatestaticList<StringBuilder>AddWordToLastLineOrCreateNewLineIfNecessary(List<StringBuilder>lines,stringword,intcolumnWidth)

VB

PrivateSharedFunctionAddWordToLastLineOrCreateNewLineIfNecessary(linesAsList(OfStringBuilder),wordAsString,columnWidthAsInteger)AsList(OfStringBuilder)

C++

private:static List<StringBuilder^>^ AddWordToLastLineOrCreateNewLineIfNecessary( List<StringBuilder^>^ lines, String^ word, int columnWidth )

F#

privatestatic memberAddWordToLastLineOrCreateNewLineIfNecessary:lines :List<StringBuilder>* word : string * columnWidth : int -> List<StringBuilder>

Parameters

lines
Type: System.Collections.Generic.List(StringBuilder)
A list of StringBuilders containing results so far
word
Type: System.String
The individual word to append
columnWidth
Type: System.Int32
The usable text space

Return Value

Type: List(StringBuilder)
The same list as is passed in

Remarks

The 'word' can actually be an empty string. It's important to keep these - empty strings allow us to preserve indentation and extra spaces within a line.

See Also

Reference

TextWrapper Class
CommandLine.Text Namespace

Clone this wiki locally