Snaplib.Unicode.ASCII
0.0.1-alpha03
Prefix Reserved
dotnet add package Snaplib.Unicode.ASCII --version 0.0.1-alpha03
NuGet\Install-Package Snaplib.Unicode.ASCII -Version 0.0.1-alpha03
<PackageReference Include="Snaplib.Unicode.ASCII" Version="0.0.1-alpha03" />
paket add Snaplib.Unicode.ASCII --version 0.0.1-alpha03
#r "nuget: Snaplib.Unicode.ASCII, 0.0.1-alpha03"
// Install Snaplib.Unicode.ASCII as a Cake Addin
#addin nuget:?package=Snaplib.Unicode.ASCII&version=0.0.1-alpha03&prerelease
// Install Snaplib.Unicode.ASCII as a Cake Tool
#tool nuget:?package=Snaplib.Unicode.ASCII&version=0.0.1-alpha03&prerelease
Snaplib Unicode ASCII
NuGet package used for programmatically representing and interpreting Unicode ASCII characters.
Unicode ASCII Characters
This package provides a consistent way to represent the different ways a Unicode ASCII character can be represented. A Unicode character can be represent via 3 types of values:
char
value- code point
int
value - and name
string
value
This package makes interpreting and translating between these different ASCII value representations a little easier. It also organizes them into categories based on common contexts they're typically used in.
Library Usage
Once this NuGet package is added to a .NET project, it exposes the
Snaplib.Unicode.ASCII
and Snaplib.Unicode.ASCII.Category
namespaces.
Snaplib.Unicode.ASCII namespace
The Snaplib.Unicode.ASCII
namespace provides 2 classes in particular designed
to be used in conjunction to programmatically represent Unicode ASCII
Characters. These classes are the Ascii
class and AsciiElement
class.
Ascii class
The Ascii
class is the main class this package intends to be used when
accessing this API. It's a static class that can be used to interpret and
represent ASCII characters. For example:
AsciiElement ascii = Ascii.OfCodePoint(65);
Console.WriteLine($"Name: \"{ascii.Name}\"");
Console.WriteLine($"Char value: '{ascii.Char}'");
Console.WriteLine($"Code point value: {ascii.CodePoint}");
Console.WriteLine($"Hex string value: \"{ascii.ToHexString()}\"");
/*
* Prints:
* --------------------
* Name: "UPPERCASE_A"
* Char value: 'A'
* Code point value: 65
* Hex string value: "0041"
*/
string asciiName = "LOWERCASE_A";
if (Ascii.TryGetChar(asciiName, out char asciiChar))
{
Console.WriteLine($"\"{asciiName}\" is the name for the ASCII character '{asciiChar}'.");
}
else
{
Console.WriteLine($"\"{asciiName}\" is not a recognized ASCII name.");
}
AsciiElement class
The AsciiElement
class is a wrapper for ASCII characters. It makes it
easy to translate each ASCII character into its different values and contains
properties such as:
- Char to contain the
char
value - CodePoint to contain the
int
value - and Name to contain the
string
name value
of the ASCII character being wrapped.
It's not possible to directly instantiate an AsciiElement
object. Instead,
references to them can be returned via the static Ascii
class:
// Below assignment is valid and won't throw an exception:
AsciiElement ascii = Ascii.OfCodePoint(65);
// However trying to instantiate an AsciiElement object with the "new" keyword
// as shown below will throw an error as there is no public constructor method:
AsciiElement asciiElement = new AsciiElement(65);
It's also possible to access AsciiElement
object references via the static
classes within the Snaplib.Unicode.ASCII.Category
namespace.
using Snaplib.Unicode.ASCII.Category;
AsciiElement[] upperCaseVowelAsciiElements =
Letters.UpperCase.Vowels.Asciis.ToArray();
foreach (AsciiElement upperCaseVowelAscii in upperCaseVowelAsciiElements)
{
char upperCaseVowelChar = upperCaseVowelAscii.Char;
Console.WriteLine($"'{upperCaseVowelChar}' is an upper case vowel.")
}
/*
* Prints:
* ---------------------------
* 'A' is an upper case vowel.
* 'E' is an upper case vowel.
* 'I' is an upper case vowel.
* 'O' is an upper case vowel.
* 'U' is an upper case vowel.
*/
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- No dependencies.
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.0.1-alpha03 | 140 | 4/7/2022 |
0.0.1-alpha | 110 | 3/30/2022 |