Class XBinaryInteger
Extension methods for IBinaryInteger{T}.
Inheritance
Namespace: Galaxon.Core.Numbers
Assembly: Galaxon.Core.dll
Syntax
public static class XBinaryInteger : object
Fields
SubscriptChars
Map from normal integer characters to their subscript versions.
Declaration
public static readonly Dictionary<char, string> SubscriptChars
Field Value
| Type | Description |
|---|---|
| Dictionary<System.Char, System.String> |
SuperscriptChars
Map from normal integer characters to their superscript versions.
Declaration
public static readonly Dictionary<char, string> SuperscriptChars
Field Value
| Type | Description |
|---|---|
| Dictionary<System.Char, System.String> |
Methods
ToSubscript<T>(T)
Render an integer as a subscript string.
This is useful for formatting denominators, the number of atoms in a molecule, atomic numbers, and other numeric subscripts when HTML is unavailable.
Declaration
public static string ToSubscript<T>(this T n)
where T : IBinaryInteger<T>
Parameters
| Type | Name | Description |
|---|---|---|
| T | n | The integer. |
Returns
| Type | Description |
|---|---|
| System.String | The string of subscript characters. |
Type Parameters
| Name | Description |
|---|---|
| T |
ToSuperscript<T>(T)
Render an integer as a superscript string.
This is useful for formatting exponents, numerators, and other numeric superscripts when HTML is unavailable.
See https://en.wikipedia.org/wiki/Unicode_subscripts_and_superscripts See https://rupertshepherd.info/resource_pages/superscript-letters-in-unicode See https://unicode-table.com/en/
Declaration
public static string ToSuperscript<T>(this T n)
where T : IBinaryInteger<T>
Parameters
| Type | Name | Description |
|---|---|---|
| T | n | The integer. |
Returns
| Type | Description |
|---|---|
| System.String | The string of superscript characters. |
Type Parameters
| Name | Description |
|---|---|
| T |