CLibNl 0.7.6

dotnet add package CLibNl --version 0.7.6
NuGet\Install-Package CLibNl -Version 0.7.6
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="CLibNl" Version="0.7.6" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CLibNl --version 0.7.6
#r "nuget: CLibNl, 0.7.6"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install CLibNl as a Cake Addin
#addin nuget:?package=CLibNl&version=0.7.6

// Install CLibNl as a Cake Tool
#tool nuget:?package=CLibNl&version=0.7.6

module Seq

  • groupAndCount (groupingMapper:'a->'b) (data:seq<'a>)
  • groupAndCountElements data

module List

  • groupAndCount (groupingMapper:'a->'b) (data:List<'a>)
  • groupAndCountElements data

module Array

  • groupAndCount (groupingMapper:'a->'b) (data:'a[])
  • groupAndCountElements data

module CSharpInterop

  • TryGetValue(o:Option<'a>, def:'a)
  • HasValue(o:Option<'a>)
  • GetValue(o:Option<'a>)
  • OfFsFunc(f:('a->'b))
  • OfFunc(func:Func<'a, 'b>)

module Patterns

  • module Inventory
    • Nsn

module DateTimeExtensions

  • DateTime.WeekOf()
  • ParseObject

module Option

  • ToNullable()

module Nullable

  • ToOption()

module FileSystemExtensions

  • FileInfo.Open()
  • DirectoryInfo.Open()
  • Uri.Open()
  • FileInfo.Serialize()
  • FileInfo.Deserialize()

module String

  • ToEnum<'T>()
  • ToSentence()
  • DecomposeString()

module Int32

  • ToHex()
  • FromHex()
  • ToBin()
  • FromBin()

module Excel

  • ToExcelObject()
  • ToExcelObjectArray()

module Cache

module Log

  • CLib.Log
  • CLib.AppLogs

module AsyncTaskRunner

module PrintToConsole

module RecordArrayToObjectArray

module PrintToConsoleExec

Draw Table

Overview

The table consists of objects that implement the ICell interface. The main implementation of this interface is TextCell, which has overloaded constructors to support various content types.

ICell Interface

The ICell interface has two get properties and one method.

Member Description
MinHeight The minimum number of character lines needed to draw the cell.
MinWidth The minimum number of characters need to draw the longest line in the cell.
Draw The method draws cell contents into a string of height represented by the first parameter, and width represented by the second parameter.

TextCell

TextCell allows the user to display multiple lines of text in a single cell. The lines are provided through the lines:string[] constructor parameter. The user can also specify text alignment through the textAlignment:TextAlignment constructor parameter.

TextCell Constructors

Parameters Description
string*TextAlignment Simple string content.
string Simple string content, aligned left.
bool Boolean value mapped into "T" or "F", aligned center.
int Integer value, thousands comma-separated, aligned right.
float*FloatingPointStyle Floating point number with specified formatting, aligned right.
float*int Floating point number rounded to the given number of decimal places, aligned right.
float Floating point number rounded to 4 decimal places, aligned right.
DateTime Only date: dd-MMM-yy aligned center. Only time: HH:mm:ss aligned center. Date and time: date on line 1 and time on line 2, aligned center.
Option<'a> Recognized types for 'a behave as described above when the Option is Some. All other Some options are treated as text through the ToString() method. None options are replaced with - as text.
obj The parameter is matched against above types. If it's an unrecognized type, the ToString() method is used to represent the text as string.

Sequence Mapping

An array of TextCell objects can be iterated over through the AsICell static method. For example:

let data : TextCell[] = ...
let dataI : ICell[] =
    data
    |> Array.map TextCell.AsICell

Table

A text table can be created by:

  1. Constructing the Table object
  2. Calling the Draw() method to create the string (or, alternatively, the Print() method to output directly to the console)

Table Constructors

Parameters Description
obj[][]*bool The object array is an array of arrays, where the inner arrays represent row columns, and the outter array represents rows. Individual obj entries are matched against defined types as described above. The Boolean parameter indicates whether or not borders should be draw with the table.
'a[]*bool The first parameter is a single column array that is automattically mapped into the above constructor.

Utility Methods and Examples

The above objects can be used with defined constructors. The library also comes with auto-opened PrintToConsoleExec module which contains two utility functions.

Utility Methods

Method Descriptoin
printWithBorders Utility function that automatically outputs to the console an array of arrays (obj[][]) input (with borders).
printRecordsAsTable Utility function that automatically extracts table columns from record fields and then outputs the results to the console (with borders).

Examples

Record as Table
type Test =
    {
        C1 : int
        C2 : float 
    }

    static member Sample() = ...

printRecordsAsTable (Test.Sample())
String Array as Table
let data =
    [|
        [| "Header 1"; "Header 2" |]
        [| "Data 1"; "Data 2" |]
    |]

printWithBorders data
Product Compatible and additional computed target framework versions.
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
0.7.6 1,076 3/14/2018
0.7.5 950 3/13/2018
0.7.3 887 2/10/2018
0.7.2 929 2/10/2018
0.7.1 937 2/6/2018
0.7.0 890 2/6/2018
0.6.1 917 2/3/2018
0.6.0 994 2/1/2018
0.5.0 892 1/25/2018
0.4.0 924 1/21/2018
0.3.0 920 1/12/2018
0.2.0 920 12/25/2017
0.1.0 863 12/25/2017
0.0.4 964 12/25/2017
0.0.3-beta 805 12/25/2017
0.0.2-beta 765 12/23/2017
0.0.1-beta 784 12/23/2017