StringBuilderExtensionReplaceLineEndings Method

Replaces all newlines in builder with replacementText.

Definition

Namespace: FolkerKinzel.Strings
Assembly: FolkerKinzel.Strings (in FolkerKinzel.Strings.dll) Version: 9.4.0+10a7d4d71aa960998e32ac0ac6c4fcbe4164c917
C#
public static StringBuilder ReplaceLineEndings(
	this StringBuilder builder,
	string? replacementText
)

Parameters

builder  StringBuilder
The StringBuilder whose content is changed.
replacementText  String
The text to use as replacement. If replacementText is null or Empty, all newlines will be removed.

Return Value

StringBuilder
A reference to builder.

Usage Note

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).

Remarks

The list of recognized newline sequences is:

  • CR (U+000D)
  • LF (U+000A)
  • CRLF (U+000D U+000A)
  • NEL (U+0085)
  • LS (U+2028)
  • FF (U+000C)
  • PS (U+2029)

This list is given by the Unicode Standard, Sec. 5.8, Recommendation R4 and Table 5-2.

Exceptions

ArgumentNullExceptionbuilder is null.

See Also