Click or drag to resize

NiceFormatter Class

A static class of extension methods that convert a variety of types into "nicely" formatted strings. Integers can be formatted as bit strings. A byte array can be formatted with the middle truncated. Tab separated lines or arrays of objects can be formatted as tables made out of box characters.
Inheritance Hierarchy
SystemObject
  Orthogonal.Common.BasicNiceFormatter

Namespace: Orthogonal.Common.Basic
Assembly: Orthogonal.Common.Basic (in Orthogonal.Common.Basic.dll) Version: 2024-04-15 18:00 GMT+10.f27da1471008deaf16b803c17e24a5955690aef1
Syntax
C#
public static class NiceFormatter

The NiceFormatter type exposes the following members.

Methods
 NameDescription
Public Extension MethodCode exampleBits(Int32) Converts an Int32 into a string of bits separated into byte groups.
Public Extension MethodCode exampleBits(Int64) Converts an Int64 into a string of bits separated into byte groups.
Public Extension MethodCode exampleBits(UInt32) Converts a UInt32 into a string of bits separated into byte groups.
Public Extension MethodCode exampleBits(UInt64) Converts a UInt64 into a string of bits separated into byte groups.
Public Extension MethodCode exampleSample(Byte, Int32) Converts a buffer into a nicely formatted string where leading and trailing bytes of a maximum length are displayed, but excess middle bytes are replaced with a count placeholder. It therefore displays a sample of a buffer of arbitrary length. The middle truncation is skipped if it is less than 8 bytes long.
Public Extension MethodCode exampleSample(String, Int32) Converts a string into a nicely formatted string whre leading and trailing characters of a maximum length are displayed, but excess middle charactes are replaced with a count placeholder. It therefore displays a sample of a string of arbitrary length. The middle truncation is skipped if it is less than 8 characters long.
Public Extension MethodCode exampleTablize Converts an enumerable set of objects (of the same type) into a mock table of rows and columns formatted using ASCII box characters. Each property in the incoming object type becomes a column of the mock table. The first row of the mock table is a header row containing the column property names.
Public methodStatic memberTablizeAdoTable Converts DataTable rows into a mock display table of rows and columns formatted using ASCII box characters. For more information see the Tablize(IEnumerableObject, NullableInt32, NullableInt32) and TablizeObj(Object, NullableInt32) methods.
Public Extension MethodCode exampleTablizeTsv Converts an enumerable set of TSV (tab separated values) formatted lines into a mock table of rows and columns formatting using ASCII box characters. Each input line is expected to contain the same number of tab separated values.
Top
See Also