Class ListInfo
This static class exposes handy constants for working with buffers, lists, and substrings.
Since static classes are implicitly sealed, this class cannot be inherited.
Inheritance
Inherited Members
Namespace: WizardWrx
Assembly: WizardWrx.Common.dll
Syntax
public static class ListInfo
Fields
| Improve this Doc View SourceBEGINNING_OF_BUFFER
Use this to signify the beginning of a binary I/O buffer.
Coincidentally, this happens to be ArrayInfo.ARRAY_FIRST_ELEMENT, which is logical, since a buffer is an array.
Declaration
public const int BEGINNING_OF_BUFFER = 0
Field Value
| Type | Description |
|---|---|
| System.Int32 |
BINARY_SEARCH_NOT_FOUND
Since the BinarySearch method on a List returns the array subscript where the value was found, a return value of less than zero (BINARY_SEARCH_NOT_FOUND) means that no matching item exists in the list.
Coincidentally, this happens to be ArrayInfo.ARRAY_INVALID_INDEX.
Declaration
public const int BINARY_SEARCH_NOT_FOUND = -1
Field Value
| Type | Description |
|---|---|
| System.Int32 |
EMPTY_STRING_LENGTH
The Length property of a string returns a value of zero (EMPTY_STRING_LENGTH) when the string is empty.
Declaration
public const int EMPTY_STRING_LENGTH = 0
Field Value
| Type | Description |
|---|---|
| System.Int32 |
INDEXOF_NOT_FOUND
This constant defines the value returned by the IndexOf method on a string to indicate that the search character or substring is not found.
Coincidentally, this happens to be ArrayInfo.ARRAY_INVALID_INDEX.
Declaration
public const int INDEXOF_NOT_FOUND = -1
Field Value
| Type | Description |
|---|---|
| System.Int32 |
LIST_IS_EMPTY
The Count property of a list returns a value of zero (LIST_IS_EMPTY) when the list is empty.
Declaration
public const int LIST_IS_EMPTY = 0
Field Value
| Type | Description |
|---|---|
| System.Int32 |
SUBSTR_BEGINNING
Since a string is an array of Unicode characters, it makes sense to treat substrings as arrays.
Coincidentally, this happens to be ArrayInfo.ARRAY_FIRST_ELEMENT, which is logical, since a substring is an array of Unicode characters.
Declaration
public const int SUBSTR_BEGINNING = 0
Field Value
| Type | Description |
|---|---|
| System.Int32 |
SUBSTR_SECOND_CHAR
Since a string is an array of Unicode characters, it makes sense to treat substrings as arrays.
Coincidentally, this happens to be ArrayInfo.ARRAY_SECOND_ELEMENT, which is logical, since a substring is an array of Unicode characters.
Declaration
public const int SUBSTR_SECOND_CHAR = 1
Field Value
| Type | Description |
|---|---|
| System.Int32 |
Methods
| Improve this Doc View SourceFirstCharOfString(String)
Return the first character of a string.
Declaration
public static char FirstCharOfString(string pstrIn)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | pstrIn | Specify the string from which to return the first character. |
Returns
| Type | Description |
|---|---|
| System.Char | Unless the input string is empty (or null), the return value is its first character. If the function cannot return the requested character, the return value is SpecialCharacters.NUL, the null character. |
LastCharacterOfString(String)
Return the last character of a string.
Declaration
public static char LastCharacterOfString(string pstrIn)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | pstrIn | Specify the string from which to return the last character. |
Returns
| Type | Description |
|---|---|
| System.Char | Unless the input string is empty (or null), the return value is its last character. If the function cannot return the requested character, the return value is SpecialCharacters.NUL, the null character. |
NthCharacterOfString(String, Int32)
Returns the character at the Nth position in a string.
Declaration
public static char NthCharacterOfString(string pstrIn, int pintOrdinalPosition)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | pstrIn | Specify the string from which to return the last character. |
| System.Int32 | pintOrdinalPosition | Specify the ordinal position of the desired character. Unlike array subscripts, which start at zero, ordinals start at one. |
Returns
| Type | Description |
|---|---|
| System.Char | Unless the input string is empty (or null), or pintOrdinalPosition is less than 1 or greater than the length of the string, the return value is the character at the specified (Nth) position. If the function cannot return the requested character, the return value is SpecialCharacters.NUL, the null character. |
PenultimateCharactrOfString(String)
Return the next to last, or penultimate, character of a string.
Declaration
public static char PenultimateCharactrOfString(string pstrIn)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | pstrIn | Specify the string from which to return the penultimate character. |
Returns
| Type | Description |
|---|---|
| System.Char | Unless the input string is empty (or null), the return value is its penultimate character. If the function cannot return the requested character, the return value is SpecialCharacters.NUL, the null character. |
SecondCharacterOfString(String)
Return the second character of a string.
Declaration
public static char SecondCharacterOfString(string pstrIn)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | pstrIn | Specify the string from which to return the second character. |
Returns
| Type | Description |
|---|---|
| System.Char | Unless the input string is empty (or null), the return value is its second character. If the function cannot return the requested character, the return value is SpecialCharacters.NUL, the null character. |