Class StringSegment
Represents a segment of a string.
Inheritance
Namespace: VRage.Game.ModAPI.Ingame.Utilities
Assembly: VRage.Game.dll
Syntax
public sealed class StringSegment : ValueType
  Constructors
StringSegment(String)
Creates a new StringSegment encompassing an entire string
Declaration
public StringSegment(string text)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | text | 
StringSegment(String, Int32, Int32)
Creates a new StringSegment for the given string area
Declaration
public StringSegment(string text, int start, int length)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | text | The original text string  | 
      
| System.Int32 | start | Where the segment starts  | 
      
| System.Int32 | length | The length of the segment  | 
      
Fields
Length
The length of the segment
Declaration
public readonly int Length
  Field Value
| Type | Description | 
|---|---|
| System.Int32 | 
Start
Where the segment starts
Declaration
public readonly int Start
  Field Value
| Type | Description | 
|---|---|
| System.Int32 | 
Text
The original text string
Declaration
public readonly string Text
  Field Value
| Type | Description | 
|---|---|
| System.String | 
Properties
IsCached
Determines whether this segment has been pre-cached in such a way that no allocation will occur when using ToString()
Declaration
public bool IsCached { get; }
  Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
IsEmpty
Determines whether this is an empty/undefined string segment
Declaration
public bool IsEmpty { get; }
  Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
Item[Int32]
Gets a character at a position relative to Start.
Declaration
public char this[int i] { get; }
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Int32 | i | 
Property Value
| Type | Description | 
|---|---|
| System.Char | 
Methods
Equals(Object)
Indicates whether this instance and a specified object are equal.
Declaration
public override bool Equals(object obj)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Object | obj | The object to compare with the current instance.  | 
      
Returns
| Type | Description | 
|---|---|
| System.Boolean | true if   | 
      
Equals(String)
Compares this string segment with the given string in a case sensitive manner.
Declaration
public bool Equals(string other)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | other | 
Returns
| Type | Description | 
|---|---|
| System.Boolean | 
  | 
      
Equals(StringSegment)
Compares this string segment with another in a case sensitive manner.
Declaration
public bool Equals(StringSegment other)
  Parameters
| Type | Name | Description | 
|---|---|---|
| StringSegment | other | 
Returns
| Type | Description | 
|---|---|
| System.Boolean | 
  | 
      
EqualsIgnoreCase(String)
Compares this string segment with the given string in a case insensitive manner.
Declaration
public bool EqualsIgnoreCase(string other)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.String | other | 
Returns
| Type | Description | 
|---|---|
| System.Boolean | 
  | 
      
EqualsIgnoreCase(StringSegment)
Compares this string segment with another in a case insensitive manner.
Declaration
public bool EqualsIgnoreCase(StringSegment other)
  Parameters
| Type | Name | Description | 
|---|---|---|
| StringSegment | other | 
Returns
| Type | Description | 
|---|---|
| System.Boolean | 
  | 
      
GetHashCode()
Returns the hash code for this instance.
Declaration
public override int GetHashCode()
  Returns
| Type | Description | 
|---|---|
| System.Int32 | A 32-bit signed integer that is the hash code for this instance.  | 
      
GetLines(List<String>)
Fills a list with individual strings representing the lines of text within this string segment, separated by newlines.
Declaration
public void GetLines(List<string> lines)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Collections.Generic.List<System.String> | lines | 
GetLines(List<StringSegment>)
Fills a list with individual string segments representing the lines of text within this string segment, separated by newlines.
Declaration
public void GetLines(List<StringSegment> lines)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Collections.Generic.List<StringSegment> | lines | 
IndexOf(Char)
Reports the zero-based index of the first occurence of the specified character, relative to Start. Returns -1 if nothing was found.
Declaration
public int IndexOf(char ch)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Char | ch | 
Returns
| Type | Description | 
|---|---|
| System.Int32 | 
IndexOf(Char, Int32)
Reports the zero-based index of the first occurence of the specified character, relative to Start. Returns -1 if nothing was found.
Declaration
public int IndexOf(char ch, int start)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Char | ch | |
| System.Int32 | start | Where to start the search (relative to Start)  | 
      
Returns
| Type | Description | 
|---|---|
| System.Int32 | 
IndexOfAny(Char[])
Reports the zero-based index of the first occurence of one of the provided characters, relative to Start. Returns -1 if nothing was found.
Declaration
public int IndexOfAny(char[] chars)
  Parameters
| Type | Name | Description | 
|---|---|---|
| System.Char[] | chars | 
Returns
| Type | Description | 
|---|---|
| System.Int32 | 
ToString()
Returns a string containing just this segment.
Declaration
public override string ToString()
  Returns
| Type | Description | 
|---|---|
| System.String |