Show / Hide Table of Contents

Class ASCIICharacterDisplayInfo

Instances of this class represent individual ASCII characters. Since the NUL character is defined, and occupies the first element, the numeric code that corresponds to a character maps directly to the corresponding element in this array.

Inheritance
System.Object
ASCIICharacterDisplayInfo
Namespace: WizardWrx
Assembly: WizardWrx.ASCIIInfo.dll
Syntax
public class ASCIICharacterDisplayInfo : object
Examples

The ASCII code for a space is 32. ASCIICharacterDisplayInfo[32], for C#, or ASCIICharacterDisplayInfo(32), for Visual Basic, returns the item for the space character.

Likewise, the ASCII code for a horizontal TAB character is 9. Hence, the C# expression ASCIICharacterDisplayInfo[9] evaluates to the information about the TAB character. Likewise, ASCIICharacterDisplayInfo(9) does the same thing in Visual Basic.

The following example comes from production code in the class library that motivated me to create this library.

ASCIICharacterDisplayInfo [ ] asciiCharTbl = ASCII_Character_Display_Table.GetTheSingleInstance ( ).AllASCIICharacters; StringBuilder sbTheBadChar = new StringBuilder ( ); sbTheBadChar.Append ( asciiCharTbl [ ( uint ) _chrBad ].DisplayText );

Obviously, more things go into the message before it is returned to the calling routine.

Properties

| Improve this Doc View Source

AlternateText

Gets an alternative visual representation of certain nonprintable and otherwise ambiguous characters, such as the SPACE character.

Declaration
public string AlternateText { get; }
Property Value
Type Description
System.String
| Improve this Doc View Source

ASCIICharacter

Gets the Unicode character represented by the code

Declaration
public char ASCIICharacter { get; }
Property Value
Type Description
System.Char
| Improve this Doc View Source

CHAR

This value is the standard two or three character acronymn for the character, including the square brackets that usually enclose it. This value is meaningful only for the Control Characters group. This value is blank for all others.

Declaration
public string CHAR { get; }
Property Value
Type Description
System.String
| Improve this Doc View Source

CharSubType

Gets the CharacterSubtype enumeration mapping of the character

Declaration
public ASCIICharacterDisplayInfo.CharacterSubtype CharSubType { get; }
Property Value
Type Description
ASCIICharacterDisplayInfo.CharacterSubtype
| Improve this Doc View Source

CharType

Gets the CharacterType enumeration mapping of the character

Declaration
public ASCIICharacterDisplayInfo.CharacterType CharType { get; }
Property Value
Type Description
ASCIICharacterDisplayInfo.CharacterType
| Improve this Doc View Source

Code

Gets the unsigned integer representation of the ASCII code

Declaration
public uint Code { get; }
Property Value
Type Description
System.UInt32
| Improve this Doc View Source

CodeAsDecimal

Gets a string representation of the raw ASCII code as a decimal number, formatted to always occupy the maximum number of characters needed, three

Declaration
public string CodeAsDecimal { get; }
Property Value
Type Description
System.String
| Improve this Doc View Source

CodeAsHexadecimal

Gets a string representation of the ASCII code as a hexadecimal number

Declaration
public string CodeAsHexadecimal { get; }
Property Value
Type Description
System.String
| Improve this Doc View Source

Comment

Gets the associated comment, if one exists, or returns the empty string.

Declaration
public string Comment { get; }
Property Value
Type Description
System.String
| Improve this Doc View Source

Description

When appropriate, this field returns a short text description of the character.

Declaration
public string Description { get; }
Property Value
Type Description
System.String
| Improve this Doc View Source

DisplayText

Use this property to guarantee that any character will display something useful when the character is presented on its own, out of context, such as in an error message.

Declaration
public string DisplayText { get; }
Property Value
Type Description
System.String
Remarks

The objective of this property is to return something that is always acceptable in printed matter, without surprises such as line feeds, line wraps, and page ejects, among other things elicited by some of the control codes.

| Improve this Doc View Source

HTMLName

This field returns the HTML entity name, when one exists, of the character, its HTML entity string. Otherwise, the return value is the empty string, represented herein by a true constant, SpecialStrings.EMPTY_STRING.

Declaration
public string HTMLName { get; }
Property Value
Type Description
System.String
Remarks

If this returns anything besides the empty string, the string returned by this property should probably take its place in HTML text.

| Improve this Doc View Source

UnicodeCodePoint

Gets a string representation of the Unicode code point

Declaration
public string UnicodeCodePoint { get; }
Property Value
Type Description
System.String
| Improve this Doc View Source

URLEncoding

Gets the URLEncoding value of the character, which is available for ANY character, though it is needed only for punctuation, control codes, white space, and other special characters

Declaration
public string URLEncoding { get; }
Property Value
Type Description
System.String

Methods

| Improve this Doc View Source

DisplayCharacterInfo(Char)

Create a ASCIICharacterDisplayInfo instance to represent a specified ASCII character, and call its ToString method to return all three representations of it (Printable, Hexadecimal, and Decimal, in that order.

Declaration
public static string DisplayCharacterInfo(char pchr)
Parameters
Type Name Description
System.Char pchr

Specify the character for which to render the three representations.

Returns
Type Description
System.String

Return the output of ToString on the ASCIICharacterDisplayInfo.

| Improve this Doc View Source

ToString()

Override ToString to render all three defined formats and most other properties.

Declaration
public override string ToString()
Returns
Type Description
System.String

The return value is a string containing a printable representation of the character, followed by its hexadecimal and decimal values, both enclosed in a single pair of parenetheses, then by every conceivable way to represent the character except the URL encoding, which can be inferred from the hexadecimal string inserted as the CodeAsHexadecimal property value.

  • Improve this Doc
  • View Source
Back to top Generated by DocFX