StringBuilderExtensionsWordWrap(StringBuilder, Int32, Boolean) Method
Wraps the input text into multiple lines whose words will fit into the specified line length.
Namespace: DevCase.Extensions.StringBuilderExtensionsAssembly: DevCase.net48 (in DevCase.net48.dll) Version: 6.0.0.0 (6.0)
XMLNS for XAML: Not mapped to an xmlns.
[EditorBrowsableAttribute(EditorBrowsableState.Always)]
public static StringBuilder WordWrap(
this StringBuilder sb,
int maxLength,
bool breakWords
)
<ExtensionAttribute>
<EditorBrowsableAttribute(EditorBrowsableState.Always)>
Public Shared Function WordWrap (
sb As StringBuilder,
maxLength As Integer,
breakWords As Boolean
) As StringBuilder
Dim sb As StringBuilder
Dim maxLength As Integer
Dim breakWords As Boolean
Dim returnValue As StringBuilder
returnValue = sb.WordWrap(maxLength,
breakWords)
public:
[ExtensionAttribute]
[EditorBrowsableAttribute(EditorBrowsableState::Always)]
static StringBuilder^ WordWrap(
StringBuilder^ sb,
int maxLength,
bool breakWords
)
[<ExtensionAttribute>]
[<EditorBrowsableAttribute(EditorBrowsableState.Always)>]
static member WordWrap :
sb : StringBuilder *
maxLength : int *
breakWords : bool -> StringBuilder
No code example is currently available or this language may not be supported.
- sb StringBuilder
-
The source StringBuilder.
- maxLength Int32
-
The maximum length of each line.
- breakWords Boolean
-
If True, break into multiple chunks the last word that does not fit in the end of the line,
ensuring this way that all the lines fills up to the specified maxLength line length.
StringBuilder
The resulting word-wrapped string.
In Visual Basic and C#, you can call this method as an instance method on any object of type
StringBuilder. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).
This is a code example.
No code example is currently available or this language may not be supported.
Dim input As String =
"About 20% of oxygen is produced by the Amazon rainforest. The Earth's atmosphere is about 78 percent nitrogen, 21 percent oxygen, and about 1 percent other gases.
For the existence of most organisms on the planet, oxygen is a necessary element, it provides the body with energy and removes carbon dioxide. Fortunately, plants constantly replenish the oxygen level of our planet thanks to photosynthesis. During this process, carbon dioxide and water are converted into energy, releasing oxygen as a byproduct.
The Amazon rainforest covers 5.5 million square kilometers (2.1 million square miles), recycling much of the Earth's oxygen while absorbing large amounts of carbon dioxide."
Dim maxLength As Integer = 50
Dim breakWords As Boolean = False
Dim sb As New StringBuilder()
sv.Append(input)
Dim result As String = WordWrap(sb, maxLength, breakWords)
Console.WriteLine(result)
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.
No code example is currently available or this language may not be supported.