Summary
Encapsulates a string to treat it as a variable substring without the memory allocation and garbage collection
costs of
System.String.Substring(System.Int32,System.Int32)
.
- Assembly
- Weaver
.dll - Namespace
- Weaver
- Interfaces
-
- IComparable
<Substring>
- IComparable
- Base Types
-
- Object
graph BT
Type-->Base0["Object"]
Type-.->Interface0["IComparable<Substring>"]
Type["Substring"]
class Type type-node
Syntax
public sealed class Substring : IComparable<Substring>
Constructors
Name | Summary |
---|---|
Substring |
Creates a new Weaver.Substring without assigning the encapsulated string or indices. |
Substring |
Creates a new Weaver.Substring with the Weaver.Substring.startIndex at 0 and the Weaver.Substring.endIndex equal to rawString.Length. |
Substring |
Creates a new Weaver.Substring with the specified Weaver.Substring.startIndex and the Weaver.Substring.endIndex equal to rawString.Length. |
Substring |
Creates a new Weaver.Substring with the specified parameters. |
Substring |
Creates a new Weaver.Substring as a copy of the specified `original`. |
Fields
Name | Constant Value | Summary |
---|---|---|
endIndex |
The character index in the
Weaver.Substring.rawString of the character immediately after the end of this substring. |
|
rawString |
The original encapsulated string.
|
|
startIndex |
The character index in the
Weaver.Substring.rawString of the start of this substring. |
Properties
Name | Value | Summary |
---|---|---|
IsAtEnd | bool |
Returns true if the end index is at or past the end of the
Weaver.Substring.rawString . |
IsValid | bool |
Returns true if the
Weaver.Substring.startIndex and Weaver.Substring.endIndex denote a valid substring within the Weaver.Substring.rawString . |
Length | int |
The number of characters in the current substring.
|
this[int] | char |
Returns
Weaver.Substring.rawString [Weaver.Substring.startIndex + i] |
Methods
Name | Value | Summary |
---|---|---|
AppendTo |
void |
Appends the characters of this
Weaver.Substring to the specified `text`.
If this Weaver.Substring is currently invalid, it appends '\0' (the NUL char).
|
CompareTo |
int |
Compares the characters in `this` to `other`.
|
CopyFrom |
void |
Copies the
Weaver.Substring.rawString , Weaver.Substring.startIndex , and Weaver.Substring.endIndex from `other`. |
Equals |
bool |
Returns true if `this` contains the same characters as `obj` (as a string or
Weaver.Substring ).
|
Equals |
bool |
Returns true if the specified substring within `a` contains the same characters as the specified substring within `b`.
static
|
Equals |
bool |
Returns true if the specified substring within `a` contains the same characters as the specified substring within `b`.
static
|
Get |
Substring |
Returns a new
Weaver.Substring encapsulating the file name within the specified `path`, without its file extension.
static
|
GetHashCode |
int |
Returns the hash code of the current value of this
Weaver.Substring .
|
IndexOf |
int |
Returns the first index of the specified `value` within this substring, or -1 if it isn't found.
The returned value is relative to the start of the
Weaver.Substring.rawString .
|
IndexOfAny |
int |
Returns the first index of any of the characters in `anyOf` within this substring, or -1 if none are found.
The returned value is relative to the start of the
Weaver.Substring.rawString .
|
LastIndexOf |
int |
Returns the last index of the specified `value` within this substring, or -1 if it isn't found.
The returned value is relative to the start of the
Weaver.Substring.rawString .
|
LastIndexOfAny |
int |
Returns the last index of any of the characters in `anyOf` within this substring, or -1 if none are found.
The returned value is relative to the start of the
Weaver.Substring.rawString .
|
MoveToNextDirectory |
bool |
Adjusts the
Weaver.Substring.startIndex and Weaver.Substring.endIndex to encapsulate the name of the next directory within the Weaver.Substring.rawString .
|
RemoveFileExtension |
void |
Adjusts the
Weaver.Substring.endIndex to remove the file extension from the end of this Weaver.Substring (if it has one).
|
Set |
void |
Assigns the specified
Weaver.Substring.rawString , sets the Weaver.Substring.startIndex to 0, and the Weaver.Substring.endIndex equal to rawString.Length. |
Set |
void |
Assigns the specified
Weaver.Substring.rawString , sets the specified Weaver.Substring.startIndex , and the Weaver.Substring.endIndex equal to rawString.Length. |
Set |
void |
Assigns the specified parameters to this
Weaver.Substring . |
StartsWith |
bool |
Returns true if this
Weaver.Substring starts with the characters in `fullString`.
|
StartsWith |
bool |
The parameters denote a substring within the `fullString`.
This method returns true if this
Weaver.Substring starts with the same characters contained in that substring.
|
StartsWith |
bool |
Returns true if this
Weaver.Substring starts with the characters in `other`.
|
ToDetailedString |
string |
Returns a description of the current state of this
Weaver.Substring .
|
ToString |
string |
Returns a new string containing the current value of this
Weaver.Substring .
|
Operators
Name | Value | Summary |
---|---|---|
implicit operator string |
string | |
operator != |
bool | |
operator != |
bool | |
operator == |
bool | |
operator == |
bool |