Legend

Class
Struct
Enum
Interface
Delegate
Constructor
Method
Property
Event
Field

Sealed class: RT.Util.Consoles.ConsoleColoredString

Summary

Encapsulates a string in which each character can have an associated ConsoleColor.

Remarks

Constructors

Initializes an empty ConsoleColoredString.
ConsoleColoredString(string input, ConsoleColor? foreground, ConsoleColor? background = null)
Constructs a ConsoleColoredString with the specified text and the specified colors.
ConsoleColoredString(string input, ConsoleColor?[] foregroundColors, ConsoleColor?[] backgroundColors = null)
Constructs a ConsoleColoredString with the specified text and the specified colors for each character.
ConsoleColoredString(params ConsoleColoredString[] strings)
Constructs a ConsoleColoredString by concatenating the specified ConsoleColoredStrings. (see also remarks)
ConsoleColoredString(params ConsoleColoredChar[] characters)
Constructs a ConsoleColoredString by concatenating the specified ConsoleColoredChars. (see also remarks)
ConsoleColoredString(FormattableString value, ConsoleColor? foreground = null, ConsoleColor? background = null)
Constructs a ConsoleColoredString from the specified FormattableString.

Instance methods

char
CharAt(int index)
Returns the character at the specified index.
ConsoleColoredString
Color(ConsoleColor? foreground)
Changes the foreground colors (but not the background colors) of every character in the current string to the specified console color.
ConsoleColoredString
Color(char character, ConsoleColor? foreground)
Changes the foreground colors (but not the background colors) of every occurrence of character in the current string to the specified console color.
ConsoleColoredString
Color(ConsoleColor? foreground, ConsoleColor? background)
Changes the colors of every character in the current string to the specified set of console colors.
ConsoleColoredString
Color(char character, ConsoleColor? foreground, ConsoleColor? background)
Changes the colors of every occurrence of character in the current string to the specified set of console colors.
ConsoleColoredString
ColorBackground(ConsoleColor? background)
Changes the background colors (but not the foreground colors) of every character in the current string to the specified console color.
ConsoleColoredString
ColorBackgroundWhereNull(ConsoleColor background)
Changes the background colors of every character in the current string to the specified console color only where there isn’t already a background color defined.
ConsoleColoredString
ColorSubstring(int index, ConsoleColor? foreground)
Colors a range of characters beginning at a specified index within the current string in a specified foreground color.
ConsoleColoredString
ColorSubstring(int index, int length, ConsoleColor? foreground)
Colors the specified range within the current string in a specified foreground color.
ConsoleColoredString
ColorSubstring(int index, ConsoleColor? foreground, ConsoleColor? background)
Colors a range of characters beginning at a specified index within the current string in the specified colors.
ConsoleColoredString
ColorSubstring(int index, int length, ConsoleColor? foreground, ConsoleColor? background)
Colors the specified range within the current string in the specified colors.
ConsoleColoredString
ColorSubstringBackground(int index, ConsoleColor? background)
Colors a range of characters beginning at a specified index within the current string in a specified background color.
ConsoleColoredString
ColorSubstringBackground(int index, int length, ConsoleColor? background)
Colors the specified range within the current string in a specified background color.
ConsoleColoredString
ColorWhereNull(ConsoleColor foreground, ConsoleColor? background = null)
Changes the colors of every character in the current string to the specified console color only where there isn’t already a color defined.
ConsoleColoredString
Fmt(params object[] args)
Equivalent to ConsoleColoredString.Format(ConsoleColoredString, params object[]).
ConsoleColoredString
Fmt(IFormatProvider provider, params object[] args)
Equivalent to ConsoleColoredString.Format(ConsoleColoredString, IFormatProvider, params object[]).
IEnumerable<object>
FmtEnumerable(params object[] args)
Formats the specified objects into this format string. The result is an enumerable collection which enumerates parts of the format string interspersed with the arguments as appropriate.
IEnumerable<object>
FmtEnumerable(IFormatProvider provider, params object[] args)
ConsoleColor?[] Returns an array describing the background color of every character in the current string.
ConsoleColor?[] Returns an array describing the foreground color of every character in the current string.
IEnumerator<ConsoleColoredChar>Implements IEnumerable<T>.GetEnumerator.
int
IndexOf(char value)
Equivalent to string.IndexOf(char).
int
IndexOf(string value)
Equivalent to string.IndexOf(string).
int
IndexOf(char value, int startIndex)
Equivalent to string.IndexOf(char, int).
int
IndexOf(string value, int startIndex)
Equivalent to string.IndexOf(string, int).
int
IndexOf(string value, StringComparison comparisonType)
Equivalent to string.IndexOf(string, StringComparison).
int
IndexOf(char value, int startIndex, int count)
Equivalent to string.IndexOf(char, int, int).
int
IndexOf(string value, int startIndex, int count)
Equivalent to string.IndexOf(string, int, int).
int
IndexOf(string value, int startIndex, StringComparison comparisonType)
Equivalent to string.IndexOf(string, int, StringComparison).
int
IndexOf(string value, int startIndex, int count, StringComparison comparisonType)
Equivalent to string.IndexOf(string, int, int, StringComparison).
ConsoleColoredString
Insert(int startIndex, ConsoleColoredString value)
Returns a new string in which a specified string is inserted at a specified index position in this instance.
ConsoleColoredString
PadLeft(int totalWidth)
Returns a new string that right-aligns the characters in this instance by padding them with spaces on the left, for a specified total length.
ConsoleColoredString
PadLeft(int totalWidth, ConsoleColoredChar paddingChar)
Returns a new string that right-aligns the characters in this instance by padding them on the left with a specified colored character, for a specified total length.
ConsoleColoredString
PadRight(int totalWidth)
Returns a new string that left-aligns the characters in this instance by padding them with spaces on the right, for a specified total length.
ConsoleColoredString
PadRight(int totalWidth, ConsoleColoredChar paddingChar)
Returns a new string that left-aligns the characters in this instance by padding them on the right with a specified colored character, for a specified total length.
ConsoleColoredString
Remove(int startIndex)
Returns a new ConsoleColoredString in which all characters from the specified startIndex onwards have been removed.
ConsoleColoredString
Remove(int startIndex, int count)
Returns a new ConsoleColoredString in which the specified range of characters has been removed.
ConsoleColoredString
Replace(char oldChar, char newChar)
Returns a new ConsoleColoredString in which every occurrence of oldChar is replaced with newChar while each character’s color remains unchanged.
ConsoleColoredString
Replace(char oldChar, ConsoleColoredChar newChar)
Returns a new ConsoleColoredString in which every occurrence of oldChar is replaced with the newChar, overwriting its color as well.
ConsoleColoredString
Replace(string oldValue, ConsoleColoredString newValue, StringComparison comparison = Ordinal)
Returns a new ConsoleColoredString in which every occurrence of the text in oldValue is replaced with a new colored string.
ConsoleColoredString
ReplaceText(string oldValue, string newValue, StringComparison comparison = Ordinal)
Returns a new ConsoleColoredString in which every occurrence of the text in oldValue is replaced with the text in newValue colored by the color of the first character in each match.
IEnumerable<ConsoleColoredString>
Split(string[] separator, int? count = null, StringSplitOptions options = None)
Returns a string array that contains the substrings in this ConsoleColoredString that are delimited by elements of a specified string array. Parameters specify the maximum number of substrings to return and whether to return empty array elements.
ConsoleColoredString
Substring(int startIndex)
Retrieves a substring from this instance. The substring starts at a specified character position.
ConsoleColoredString
Substring(int startIndex, int length)
Retrieves a substring from this instance. The substring starts at a specified character position and has a specified length.
string
  • Overrides: object.ToString()
Returns the raw text of this ConsoleColoredString by discarding all the color information.

Static methods

ConsoleColoredString
Format(ConsoleColoredString format, params object[] args)
Replaces each format item in a specified string with the string representation of a corresponding object in a specified array.
ConsoleColoredString
Format(ConsoleColoredString format, IFormatProvider provider, params object[] args)
Replaces the format item in a specified string with the string representation of a corresponding object in a specified array. A specified parameter supplies culture-specific formatting information.
ConsoleColoredString Constructs a ConsoleColoredString from an EggsML parse tree. (see also remarks)

Operators

ConsoleColoredString Concatenates two ConsoleColoredStrings. (see also remarks)
ConsoleColoredString
operator+(ConsoleColoredString string1, string string2)
Concatenates a string onto a ConsoleColoredString. (see also remarks)
ConsoleColoredString
operator+(string string1, ConsoleColoredString string2)
Concatenates a ConsoleColoredString onto a string. (see also remarks)
string Provides explicit conversion from ConsoleColoredString to String by discarding all color information.
ConsoleColoredString Provides implicit conversion from String to ConsoleColoredString.

Static properties

ConsoleColoredStringRepresents an empty colored string. This field is read-only.
ConsoleColoredStringRepresents the environment's newline, colored in the default color. This field is read-only.

Instance properties

ConsoleColoredChar
this[int index]
Gets the character and color at a specified character position in the current colored string.
intReturns the number of characters in this ConsoleColoredString.
string Returns a string in which the coloration of this ConsoleColoredString is represented as user-readable text.