using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
namespace System.Text
{
/// Represents a mutable string of characters. This class cannot be inherited.
/// 1
// Token: 0x020005FA RID: 1530
[ComVisible(true)]
[MonoTODO("Serialization format not compatible with .NET")]
[Serializable]
public sealed class StringBuilder : ISerializable
{
/// Initializes a new instance of the class from the specified substring and capacity.
/// The string that contains the substring used to initialize the value of this instance. If is null, the new will contain the empty string (that is, it contains ).
/// The position within where the substring begins.
/// The number of characters in the substring.
/// The suggested starting size of the .
///
/// is less than zero.-or- plus is not a position within .
// Token: 0x060037BB RID: 14267 RVA: 0x000BF188 File Offset: 0x000BD388
public StringBuilder(string value, int startIndex, int length, int capacity)
: this(value, startIndex, length, capacity, int.MaxValue)
{
}
// Token: 0x060037BC RID: 14268 RVA: 0x000BF19C File Offset: 0x000BD39C
private StringBuilder(string value, int startIndex, int length, int capacity, int maxCapacity)
{
if (value == null)
{
value = string.Empty;
}
if (startIndex < 0)
{
throw new ArgumentOutOfRangeException("startIndex", startIndex, "StartIndex cannot be less than zero.");
}
if (length < 0)
{
throw new ArgumentOutOfRangeException("length", length, "Length cannot be less than zero.");
}
if (capacity < 0)
{
throw new ArgumentOutOfRangeException("capacity", capacity, "capacity must be greater than zero.");
}
if (maxCapacity < 1)
{
throw new ArgumentOutOfRangeException("maxCapacity", "maxCapacity is less than one.");
}
if (capacity > maxCapacity)
{
throw new ArgumentOutOfRangeException("capacity", "Capacity exceeds maximum capacity.");
}
if (startIndex > value.Length - length)
{
throw new ArgumentOutOfRangeException("startIndex", startIndex, "StartIndex and length must refer to a location within the string.");
}
if (capacity == 0)
{
if (maxCapacity > 16)
{
capacity = 16;
}
else
{
this._str = (this._cached_str = string.Empty);
}
}
this._maxCapacity = maxCapacity;
if (this._str == null)
{
this._str = string.InternalAllocateStr((length <= capacity) ? capacity : length);
}
if (length > 0)
{
string.CharCopy(this._str, 0, value, startIndex, length);
}
this._length = length;
}
/// Initializes a new instance of the class.
// Token: 0x060037BD RID: 14269 RVA: 0x000BF2E4 File Offset: 0x000BD4E4
public StringBuilder()
: this(null)
{
}
/// Initializes a new instance of the class using the specified capacity.
/// The suggested starting size of this instance.
///
/// is less than zero.
// Token: 0x060037BE RID: 14270 RVA: 0x000BF2F0 File Offset: 0x000BD4F0
public StringBuilder(int capacity)
: this(string.Empty, 0, 0, capacity)
{
}
/// Initializes a new instance of the class that starts with a specified capacity and can grow to a specified maximum.
/// The suggested starting size of the .
/// The maximum number of characters the current string can contain.
///
/// is less than one, is less than zero, or is greater than .
// Token: 0x060037BF RID: 14271 RVA: 0x000BF300 File Offset: 0x000BD500
public StringBuilder(int capacity, int maxCapacity)
: this(string.Empty, 0, 0, capacity, maxCapacity)
{
}
/// Initializes a new instance of the class using the specified string.
/// The string used to initialize the value of the instance. If is null, the new will contain the empty string (that is, it contains ).
// Token: 0x060037C0 RID: 14272 RVA: 0x000BF314 File Offset: 0x000BD514
public StringBuilder(string value)
{
if (value == null)
{
value = string.Empty;
}
this._length = value.Length;
this._str = (this._cached_str = value);
this._maxCapacity = int.MaxValue;
}
/// Initializes a new instance of the class using the specified string and capacity.
/// The string used to initialize the value of the instance. If is null, the new will contain the empty string (that is, it contains ).
/// The suggested starting size of the .
///
/// is less than zero.
// Token: 0x060037C1 RID: 14273 RVA: 0x000BF35C File Offset: 0x000BD55C
public StringBuilder(string value, int capacity)
: this((value != null) ? value : string.Empty, 0, (value != null) ? value.Length : 0, capacity)
{
}
// Token: 0x060037C2 RID: 14274 RVA: 0x000BF394 File Offset: 0x000BD594
private StringBuilder(SerializationInfo info, StreamingContext context)
{
string text = info.GetString("m_StringValue");
if (text == null)
{
text = string.Empty;
}
this._length = text.Length;
this._str = (this._cached_str = text);
this._maxCapacity = info.GetInt32("m_MaxCapacity");
if (this._maxCapacity < 0)
{
this._maxCapacity = int.MaxValue;
}
this.Capacity = info.GetInt32("Capacity");
}
/// Populates a object with the data necessary to deserialize the current object.
/// The object to populate with serialization information.
/// The place to store and retrieve serialized data. Reserved for future use.
///
/// is null.
// Token: 0x060037C3 RID: 14275 RVA: 0x000BF414 File Offset: 0x000BD614
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("m_MaxCapacity", this._maxCapacity);
info.AddValue("Capacity", this.Capacity);
info.AddValue("m_StringValue", this.ToString());
info.AddValue("m_currentThread", 0);
}
/// Gets the maximum capacity of this instance.
/// The maximum number of characters this instance can hold.
/// 2
// Token: 0x17000AF8 RID: 2808
// (get) Token: 0x060037C4 RID: 14276 RVA: 0x000BF460 File Offset: 0x000BD660
public int MaxCapacity
{
get
{
return this._maxCapacity;
}
}
/// Gets or sets the maximum number of characters that can be contained in the memory allocated by the current instance.
/// The maximum number of characters that can be contained in the memory allocated by the current instance.
/// The value specified for a set operation is less than the current length of this instance.-or- The value specified for a set operation is greater than the maximum capacity.
/// 2
// Token: 0x17000AF9 RID: 2809
// (get) Token: 0x060037C5 RID: 14277 RVA: 0x000BF468 File Offset: 0x000BD668
// (set) Token: 0x060037C6 RID: 14278 RVA: 0x000BF494 File Offset: 0x000BD694
public int Capacity
{
get
{
if (this._str.Length == 0)
{
return Math.Min(this._maxCapacity, 16);
}
return this._str.Length;
}
set
{
if (value < this._length)
{
throw new ArgumentException("Capacity must be larger than length");
}
if (value > this._maxCapacity)
{
throw new ArgumentOutOfRangeException("value", "Should be less than or equal to MaxCapacity");
}
this.InternalEnsureCapacity(value);
}
}
/// Gets or sets the length of the current object.
/// The length of this instance.
/// The value specified for a set operation is less than zero or greater than .
/// 1
// Token: 0x17000AFA RID: 2810
// (get) Token: 0x060037C7 RID: 14279 RVA: 0x000BF4DC File Offset: 0x000BD6DC
// (set) Token: 0x060037C8 RID: 14280 RVA: 0x000BF4E4 File Offset: 0x000BD6E4
public int Length
{
get
{
return this._length;
}
set
{
if (value < 0 || value > this._maxCapacity)
{
throw new ArgumentOutOfRangeException();
}
if (value == this._length)
{
return;
}
if (value < this._length)
{
this.InternalEnsureCapacity(value);
this._length = value;
}
else
{
this.Append('\0', value - this._length);
}
}
}
/// Gets or sets the character at the specified character position in this instance.
/// The Unicode character at position .
/// The position of the character.
///
/// is outside the bounds of this instance while setting a character.
///
/// is outside the bounds of this instance while getting a character.
/// 2
// Token: 0x17000AFB RID: 2811
[IndexerName("Chars")]
public char this[int index]
{
get
{
if (index >= this._length || index < 0)
{
throw new IndexOutOfRangeException();
}
return this._str[index];
}
set
{
if (index >= this._length || index < 0)
{
throw new IndexOutOfRangeException();
}
if (this._cached_str != null)
{
this.InternalEnsureCapacity(this._length);
}
this._str.InternalSetChar(index, value);
}
}
/// Converts the value of this instance to a .
/// A string whose value is the same as this instance.
/// 1
// Token: 0x060037CB RID: 14283 RVA: 0x000BF5B0 File Offset: 0x000BD7B0
public override string ToString()
{
if (this._length == 0)
{
return string.Empty;
}
if (this._cached_str != null)
{
return this._cached_str;
}
if (this._length < this._str.Length >> 1)
{
this._cached_str = this._str.SubstringUnchecked(0, this._length);
return this._cached_str;
}
this._cached_str = this._str;
this._str.InternalSetLength(this._length);
return this._str;
}
/// Converts the value of a substring of this instance to a .
/// A string whose value is the same as the specified substring of this instance.
/// The starting position of the substring in this instance.
/// The length of the substring.
///
/// or is less than zero.-or- The sum of and is greater than the length of the current instance.
/// 1
// Token: 0x060037CC RID: 14284 RVA: 0x000BF63C File Offset: 0x000BD83C
public string ToString(int startIndex, int length)
{
if (startIndex < 0 || length < 0 || startIndex > this._length - length)
{
throw new ArgumentOutOfRangeException();
}
if (startIndex == 0 && length == this._length)
{
return this.ToString();
}
return this._str.SubstringUnchecked(startIndex, length);
}
/// Ensures that the capacity of this instance of is at least the specified value.
/// The new capacity of this instance.
/// The minimum capacity to ensure.
///
/// is less than zero.-or- Enlarging the value of this instance would exceed .
/// 2
// Token: 0x060037CD RID: 14285 RVA: 0x000BF694 File Offset: 0x000BD894
public int EnsureCapacity(int capacity)
{
if (capacity < 0)
{
throw new ArgumentOutOfRangeException("Capacity must be greater than 0.");
}
if (capacity <= this._str.Length)
{
return this._str.Length;
}
this.InternalEnsureCapacity(capacity);
return this._str.Length;
}
/// Returns a value indicating whether this instance is equal to a specified object.
/// true if this instance and have equal string, , and values; otherwise, false.
/// An object to compare with this instance or null.
/// 2
// Token: 0x060037CE RID: 14286 RVA: 0x000BF6E4 File Offset: 0x000BD8E4
public bool Equals(StringBuilder sb)
{
return sb != null && (this._length == sb.Length && this._str == sb._str);
}
/// Removes the specified range of characters from this instance.
/// A reference to this instance after the excise operation has completed.
/// The zero-based position in this instance where removal begins.
/// The number of characters to remove.
/// If or is less than zero, or + is greater than the length of this instance.
/// 1
// Token: 0x060037CF RID: 14287 RVA: 0x000BF724 File Offset: 0x000BD924
public StringBuilder Remove(int startIndex, int length)
{
if (startIndex < 0 || length < 0 || startIndex > this._length - length)
{
throw new ArgumentOutOfRangeException();
}
if (this._cached_str != null)
{
this.InternalEnsureCapacity(this._length);
}
if (this._length - (startIndex + length) > 0)
{
string.CharCopy(this._str, startIndex, this._str, startIndex + length, this._length - (startIndex + length));
}
this._length -= length;
return this;
}
/// Replaces all occurrences of a specified character in this instance with another specified character.
/// A reference to this instance with replaced by .
/// The character to replace.
/// The character that replaces .
/// 1
// Token: 0x060037D0 RID: 14288 RVA: 0x000BF7A8 File Offset: 0x000BD9A8
public StringBuilder Replace(char oldChar, char newChar)
{
return this.Replace(oldChar, newChar, 0, this._length);
}
/// Replaces, within a substring of this instance, all occurrences of a specified character with another specified character.
/// A reference to this instance with replaced by in the range from to + -1.
/// The character to replace.
/// The character that replaces .
/// The position in this instance where the substring begins.
/// The length of the substring.
///
/// + is greater than the length of the value of this instance.-or- or is less than zero.
/// 1
// Token: 0x060037D1 RID: 14289 RVA: 0x000BF7BC File Offset: 0x000BD9BC
public StringBuilder Replace(char oldChar, char newChar, int startIndex, int count)
{
if (startIndex > this._length - count || startIndex < 0 || count < 0)
{
throw new ArgumentOutOfRangeException();
}
if (this._cached_str != null)
{
this.InternalEnsureCapacity(this._str.Length);
}
for (int i = startIndex; i < startIndex + count; i++)
{
if (this._str[i] == oldChar)
{
this._str.InternalSetChar(i, newChar);
}
}
return this;
}
/// Replaces all occurrences of a specified string in this instance with another specified string.
/// A reference to this instance with all instances of replaced by .
/// The string to replace.
/// The string that replaces , or null.
///
/// is null.
/// The length of is zero.
/// Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037D2 RID: 14290 RVA: 0x000BF840 File Offset: 0x000BDA40
public StringBuilder Replace(string oldValue, string newValue)
{
return this.Replace(oldValue, newValue, 0, this._length);
}
/// Replaces, within a substring of this instance, all occurrences of a specified string with another specified string.
/// A reference to this instance with all instances of replaced by in the range from to + - 1.
/// The string to replace.
/// The string that replaces , or null.
/// The position in this instance where the substring begins.
/// The length of the substring.
///
/// is null.
/// The length of is zero.
///
/// or is less than zero.-or- plus indicates a character position not within this instance.-or- Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037D3 RID: 14291 RVA: 0x000BF854 File Offset: 0x000BDA54
public StringBuilder Replace(string oldValue, string newValue, int startIndex, int count)
{
if (oldValue == null)
{
throw new ArgumentNullException("The old value cannot be null.");
}
if (startIndex < 0 || count < 0 || startIndex > this._length - count)
{
throw new ArgumentOutOfRangeException();
}
if (oldValue.Length == 0)
{
throw new ArgumentException("The old value cannot be zero length.");
}
string text = this._str.Substring(startIndex, count);
string text2 = text.Replace(oldValue, newValue);
if (text2 == text)
{
return this;
}
this.InternalEnsureCapacity(text2.Length + (this._length - count));
if (text2.Length < count)
{
string.CharCopy(this._str, startIndex + text2.Length, this._str, startIndex + count, this._length - startIndex - count);
}
else if (text2.Length > count)
{
string.CharCopyReverse(this._str, startIndex + text2.Length, this._str, startIndex + count, this._length - startIndex - count);
}
string.CharCopy(this._str, startIndex, text2, 0, text2.Length);
this._length = text2.Length + (this._length - count);
return this;
}
/// Appends the string representation of the Unicode characters in a specified array to the end of this instance.
/// A reference to this instance after the append operation has completed.
/// The array of characters to append.
/// Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037D4 RID: 14292 RVA: 0x000BF980 File Offset: 0x000BDB80
public StringBuilder Append(char[] value)
{
if (value == null)
{
return this;
}
int num = this._length + value.Length;
if (this._cached_str != null || this._str.Length < num)
{
this.InternalEnsureCapacity(num);
}
string.CharCopy(this._str, this._length, value, 0, value.Length);
this._length = num;
return this;
}
/// Appends a copy of the specified string to the end of this instance.
/// A reference to this instance after the append operation has completed.
/// The string to append.
/// Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037D5 RID: 14293 RVA: 0x000BF9E4 File Offset: 0x000BDBE4
public StringBuilder Append(string value)
{
if (value == null)
{
return this;
}
if (this._length == 0 && value.Length < this._maxCapacity && value.Length > this._str.Length)
{
this._length = value.Length;
this._cached_str = value;
this._str = value;
return this;
}
int num = this._length + value.Length;
if (this._cached_str != null || this._str.Length < num)
{
this.InternalEnsureCapacity(num);
}
string.CharCopy(this._str, this._length, value, 0, value.Length);
this._length = num;
return this;
}
/// Appends the string representation of a specified Boolean value to the end of this instance.
/// A reference to this instance after the append operation has completed.
/// The Boolean value to append.
/// Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037D6 RID: 14294 RVA: 0x000BFA9C File Offset: 0x000BDC9C
public StringBuilder Append(bool value)
{
return this.Append(value.ToString());
}
/// Appends the string representation of a specified 8-bit unsigned integer to the end of this instance.
/// A reference to this instance after the append operation has completed.
/// The value to append.
/// Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037D7 RID: 14295 RVA: 0x000BFAAC File Offset: 0x000BDCAC
public StringBuilder Append(byte value)
{
return this.Append(value.ToString());
}
/// Appends the string representation of a specified decimal number to the end of this instance.
/// A reference to this instance after the append operation has completed.
/// The value to append.
/// Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037D8 RID: 14296 RVA: 0x000BFABC File Offset: 0x000BDCBC
public StringBuilder Append(decimal value)
{
return this.Append(value.ToString());
}
/// Appends the string representation of a specified double-precision floating-point number to the end of this instance.
/// A reference to this instance after the append operation has completed.
/// The value to append.
/// Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037D9 RID: 14297 RVA: 0x000BFACC File Offset: 0x000BDCCC
public StringBuilder Append(double value)
{
return this.Append(value.ToString());
}
/// Appends the string representation of a specified 16-bit signed integer to the end of this instance.
/// A reference to this instance after the append operation has completed.
/// The value to append.
/// Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037DA RID: 14298 RVA: 0x000BFADC File Offset: 0x000BDCDC
public StringBuilder Append(short value)
{
return this.Append(value.ToString());
}
/// Appends the string representation of a specified 32-bit signed integer to the end of this instance.
/// A reference to this instance after the append operation has completed.
/// The value to append.
/// Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037DB RID: 14299 RVA: 0x000BFAEC File Offset: 0x000BDCEC
public StringBuilder Append(int value)
{
return this.Append(value.ToString());
}
/// Appends the string representation of a specified 64-bit signed integer to the end of this instance.
/// A reference to this instance after the append operation has completed.
/// The value to append.
/// Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037DC RID: 14300 RVA: 0x000BFAFC File Offset: 0x000BDCFC
public StringBuilder Append(long value)
{
return this.Append(value.ToString());
}
/// Appends the string representation of a specified object to the end of this instance.
/// A reference to this instance after the append operation has completed.
/// The object to append.
/// Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037DD RID: 14301 RVA: 0x000BFB0C File Offset: 0x000BDD0C
public StringBuilder Append(object value)
{
if (value == null)
{
return this;
}
return this.Append(value.ToString());
}
/// Appends the string representation of a specified 8-bit signed integer to the end of this instance.
/// A reference to this instance after the append operation has completed.
/// The value to append.
/// Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037DE RID: 14302 RVA: 0x000BFB24 File Offset: 0x000BDD24
[CLSCompliant(false)]
public StringBuilder Append(sbyte value)
{
return this.Append(value.ToString());
}
/// Appends the string representation of a specified single-precision floating-point number to the end of this instance.
/// A reference to this instance after the append operation has completed.
/// The value to append.
/// Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037DF RID: 14303 RVA: 0x000BFB34 File Offset: 0x000BDD34
public StringBuilder Append(float value)
{
return this.Append(value.ToString());
}
/// Appends the string representation of a specified 16-bit unsigned integer to the end of this instance.
/// A reference to this instance after the append operation has completed.
/// The value to append.
/// Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037E0 RID: 14304 RVA: 0x000BFB44 File Offset: 0x000BDD44
[CLSCompliant(false)]
public StringBuilder Append(ushort value)
{
return this.Append(value.ToString());
}
/// Appends the string representation of a specified 32-bit unsigned integer to the end of this instance.
/// A reference to this instance after the append operation has completed.
/// The value to append.
/// Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037E1 RID: 14305 RVA: 0x000BFB54 File Offset: 0x000BDD54
[CLSCompliant(false)]
public StringBuilder Append(uint value)
{
return this.Append(value.ToString());
}
/// Appends the string representation of a specified 64-bit unsigned integer to the end of this instance.
/// A reference to this instance after the append operation has completed.
/// The value to append.
/// Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037E2 RID: 14306 RVA: 0x000BFB64 File Offset: 0x000BDD64
[CLSCompliant(false)]
public StringBuilder Append(ulong value)
{
return this.Append(value.ToString());
}
/// Appends the string representation of a specified Unicode character to the end of this instance.
/// A reference to this instance after the append operation has completed.
/// The Unicode character to append.
/// Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037E3 RID: 14307 RVA: 0x000BFB74 File Offset: 0x000BDD74
public StringBuilder Append(char value)
{
int num = this._length + 1;
if (this._cached_str != null || this._str.Length < num)
{
this.InternalEnsureCapacity(num);
}
this._str.InternalSetChar(this._length, value);
this._length = num;
return this;
}
/// Appends a specified number of copies of the string representation of a Unicode character to the end of this instance.
/// A reference to this instance after the append operation has completed.
/// The character to append.
/// The number of times to append .
///
/// is less than zero.-or- Enlarging the value of this instance would exceed .
/// Out of memory.
/// 1
// Token: 0x060037E4 RID: 14308 RVA: 0x000BFBC8 File Offset: 0x000BDDC8
public StringBuilder Append(char value, int repeatCount)
{
if (repeatCount < 0)
{
throw new ArgumentOutOfRangeException();
}
this.InternalEnsureCapacity(this._length + repeatCount);
for (int i = 0; i < repeatCount; i++)
{
this._str.InternalSetChar(this._length++, value);
}
return this;
}
/// Appends the string representation of a specified subarray of Unicode characters to the end of this instance.
/// A reference to this instance after the append operation has completed.
/// A character array.
/// The zero-based starting position in .
/// The number of characters to append.
///
/// is null, and and are not zero.
///
/// is less than zero.-or- is less than zero.-or- + is greater than the length of .-or- Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037E5 RID: 14309 RVA: 0x000BFC20 File Offset: 0x000BDE20
public StringBuilder Append(char[] value, int startIndex, int charCount)
{
if (value == null)
{
if (startIndex != 0 || charCount != 0)
{
throw new ArgumentNullException("value");
}
return this;
}
else
{
if (charCount < 0 || startIndex < 0 || startIndex > value.Length - charCount)
{
throw new ArgumentOutOfRangeException();
}
int num = this._length + charCount;
this.InternalEnsureCapacity(num);
string.CharCopy(this._str, this._length, value, startIndex, charCount);
this._length = num;
return this;
}
}
/// Appends a copy of a specified substring to the end of this instance.
/// A reference to this instance after the append operation has completed.
/// The string that contains the substring to append.
/// The zero-based starting position of the substring within .
/// The number of characters in to append.
///
/// is null, and and are not zero.
///
/// less than zero.-or- less than zero.-or- + is greater than the length of .-or- Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037E6 RID: 14310 RVA: 0x000BFC98 File Offset: 0x000BDE98
public StringBuilder Append(string value, int startIndex, int count)
{
if (value == null)
{
if (startIndex != 0 && count != 0)
{
throw new ArgumentNullException("value");
}
return this;
}
else
{
if (count < 0 || startIndex < 0 || startIndex > value.Length - count)
{
throw new ArgumentOutOfRangeException();
}
int num = this._length + count;
if (this._cached_str != null || this._str.Length < num)
{
this.InternalEnsureCapacity(num);
}
string.CharCopy(this._str, this._length, value, startIndex, count);
this._length = num;
return this;
}
}
/// Appends the default line terminator to the end of the current object.
/// A reference to this instance after the append operation has completed.
/// Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037E7 RID: 14311 RVA: 0x000BFD30 File Offset: 0x000BDF30
[ComVisible(false)]
public StringBuilder AppendLine()
{
return this.Append(Environment.NewLine);
}
/// Appends a copy of the specified string followed by the default line terminator to the end of the current object.
/// A reference to this instance after the append operation has completed.
/// The to append.
/// Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037E8 RID: 14312 RVA: 0x000BFD40 File Offset: 0x000BDF40
[ComVisible(false)]
public StringBuilder AppendLine(string value)
{
return this.Append(value).Append(Environment.NewLine);
}
/// Appends the string returned by processing a composite format string, which contains zero or more format items, to this instance. Each format item is replaced by the string representation of a corresponding argument in a parameter array.
/// A reference to this instance with appended. Each format item in is replaced by the string representation of the corresponding object argument.
/// A composite format string (see Remarks).
/// An array of objects to format.
///
/// or is null.
///
/// is invalid. -or-The index of a format item is less than 0 (zero), or greater than or equal to the length of the array.
/// The length of the expanded string would exceed .
/// 2
// Token: 0x060037E9 RID: 14313 RVA: 0x000BFD54 File Offset: 0x000BDF54
public StringBuilder AppendFormat(string format, params object[] args)
{
return this.AppendFormat(null, format, args);
}
/// Appends the string returned by processing a composite format string, which contains zero or more format items, to this instance. Each format item is replaced by the string representation of a corresponding argument in a parameter array using a specified format provider.
/// A reference to this instance after the append operation has completed. After the append operation, this instance contains any data that existed before the operation, suffixed by a copy of , where each format item is replaced by the string representation of the corresponding object argument.
/// An object that supplies culture-specific formatting information.
/// A composite format string (see Remarks).
/// An array of objects to format.
///
/// is null.
///
/// is invalid.-or-The index of a format item is less than 0 (zero), or greater than or equal to the length of the array.
/// The length of the expanded string would exceed .
/// 2
// Token: 0x060037EA RID: 14314 RVA: 0x000BFD60 File Offset: 0x000BDF60
public StringBuilder AppendFormat(IFormatProvider provider, string format, params object[] args)
{
string.FormatHelper(this, provider, format, args);
return this;
}
/// Appends the string returned by processing a composite format string, which contains zero or more format items, to this instance. Each format item is replaced by the string representation of a single argument.
/// A reference to this instance with appended. Each format item in is replaced by the string representation of .
/// A composite format string (see Remarks).
/// An object to format.
///
/// is null.
///
/// is invalid. -or-The index of a format item is less than 0 (zero), or greater than or equal to 1.
/// The length of the expanded string would exceed .
/// 2
// Token: 0x060037EB RID: 14315 RVA: 0x000BFD70 File Offset: 0x000BDF70
public StringBuilder AppendFormat(string format, object arg0)
{
return this.AppendFormat(null, format, new object[] { arg0 });
}
/// Appends the string returned by processing a composite format string, which contains zero or more format items, to this instance. Each format item is replaced by the string representation of either of two arguments.
/// A reference to this instance with appended. Each format item in is replaced by the string representation of the corresponding object argument.
/// A composite format string (see Remarks).
/// The first object to format.
/// The second object to format.
///
/// is null.
///
/// is invalid. -or-The index of a format item is less than 0 (zero), or greater than or equal to 2.
/// The length of the expanded string would exceed .
/// 2
// Token: 0x060037EC RID: 14316 RVA: 0x000BFD84 File Offset: 0x000BDF84
public StringBuilder AppendFormat(string format, object arg0, object arg1)
{
return this.AppendFormat(null, format, new object[] { arg0, arg1 });
}
/// Appends the string returned by processing a composite format string, which contains zero or more format items, to this instance. Each format item is replaced by the string representation of either of three arguments.
/// A reference to this instance with appended. Each format item in is replaced by the string representation of the corresponding object argument.
/// A composite format string (see Remarks).
/// The first object to format.
/// The second object to format.
/// The third object to format.
///
/// is null.
///
/// is invalid. -or-The index of a format item is less than 0 (zero), or greater than or equal to 3.
/// The length of the expanded string would exceed .
/// 2
// Token: 0x060037ED RID: 14317 RVA: 0x000BFD9C File Offset: 0x000BDF9C
public StringBuilder AppendFormat(string format, object arg0, object arg1, object arg2)
{
return this.AppendFormat(null, format, new object[] { arg0, arg1, arg2 });
}
/// Inserts the string representation of a specified array of Unicode characters into this instance at the specified character position.
/// A reference to this instance after the insert operation has completed.
/// The position in this instance where insertion begins.
/// The character array to insert.
///
/// is less than zero or greater than the length of this instance.-or- Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037EE RID: 14318 RVA: 0x000BFDBC File Offset: 0x000BDFBC
public StringBuilder Insert(int index, char[] value)
{
return this.Insert(index, new string(value));
}
/// Inserts a string into this instance at the specified character position.
/// A reference to this instance after the insert operation has completed.
/// The position in this instance where insertion begins.
/// The string to insert.
///
/// is less than zero or greater than the current length of this instance. -or-The current length of this object plus the length of exceeds .
/// 1
// Token: 0x060037EF RID: 14319 RVA: 0x000BFDCC File Offset: 0x000BDFCC
public StringBuilder Insert(int index, string value)
{
if (index > this._length || index < 0)
{
throw new ArgumentOutOfRangeException();
}
if (value == null || value.Length == 0)
{
return this;
}
this.InternalEnsureCapacity(this._length + value.Length);
string.CharCopyReverse(this._str, index + value.Length, this._str, index, this._length - index);
string.CharCopy(this._str, index, value, 0, value.Length);
this._length += value.Length;
return this;
}
/// Inserts the string representation of a Boolean value into this instance at the specified character position.
/// A reference to this instance after the insert operation has completed.
/// The position in this instance where insertion begins.
/// The value to insert.
///
/// is less than zero or greater than the length of this instance.-or- Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037F0 RID: 14320 RVA: 0x000BFE64 File Offset: 0x000BE064
public StringBuilder Insert(int index, bool value)
{
return this.Insert(index, value.ToString());
}
/// Inserts the string representation of a specified 8-bit unsigned integer into this instance at the specified character position.
/// A reference to this instance after the insert operation has completed.
/// The position in this instance where insertion begins.
/// The value to insert.
///
/// is less than zero or greater than the length of this instance.-or- Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037F1 RID: 14321 RVA: 0x000BFE74 File Offset: 0x000BE074
public StringBuilder Insert(int index, byte value)
{
return this.Insert(index, value.ToString());
}
/// Inserts the string representation of a specified Unicode character into this instance at the specified character position.
/// A reference to this instance after the insert operation has completed.
/// The position in this instance where insertion begins.
/// The value to insert.
///
/// is less than zero or greater than the length of this instance.-or- Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037F2 RID: 14322 RVA: 0x000BFE84 File Offset: 0x000BE084
public StringBuilder Insert(int index, char value)
{
if (index > this._length || index < 0)
{
throw new ArgumentOutOfRangeException("index");
}
this.InternalEnsureCapacity(this._length + 1);
string.CharCopyReverse(this._str, index + 1, this._str, index, this._length - index);
this._str.InternalSetChar(index, value);
this._length++;
return this;
}
/// Inserts the string representation of a decimal number into this instance at the specified character position.
/// A reference to this instance after the insert operation has completed.
/// The position in this instance where insertion begins.
/// The value to insert.
///
/// is less than zero or greater than the length of this instance.-or- Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037F3 RID: 14323 RVA: 0x000BFEF8 File Offset: 0x000BE0F8
public StringBuilder Insert(int index, decimal value)
{
return this.Insert(index, value.ToString());
}
/// Inserts the string representation of a double-precision floating-point number into this instance at the specified character position.
/// A reference to this instance after the insert operation has completed.
/// The position in this instance where insertion begins.
/// The value to insert.
///
/// is less than zero or greater than the length of this instance.-or- Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037F4 RID: 14324 RVA: 0x000BFF08 File Offset: 0x000BE108
public StringBuilder Insert(int index, double value)
{
return this.Insert(index, value.ToString());
}
/// Inserts the string representation of a specified 16-bit signed integer into this instance at the specified character position.
/// A reference to this instance after the insert operation has completed.
/// The position in this instance where insertion begins.
/// The value to insert.
///
/// is less than zero or greater than the length of this instance.-or- Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037F5 RID: 14325 RVA: 0x000BFF18 File Offset: 0x000BE118
public StringBuilder Insert(int index, short value)
{
return this.Insert(index, value.ToString());
}
/// Inserts the string representation of a specified 32-bit signed integer into this instance at the specified character position.
/// A reference to this instance after the insert operation has completed.
/// The position in this instance where insertion begins.
/// The value to insert.
///
/// is less than zero or greater than the length of this instance.-or- Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037F6 RID: 14326 RVA: 0x000BFF28 File Offset: 0x000BE128
public StringBuilder Insert(int index, int value)
{
return this.Insert(index, value.ToString());
}
/// Inserts the string representation of a 64-bit signed integer into this instance at the specified character position.
/// A reference to this instance after the insert operation has completed.
/// The position in this instance where insertion begins.
/// The value to insert.
///
/// is less than zero or greater than the length of this instance.-or- Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037F7 RID: 14327 RVA: 0x000BFF38 File Offset: 0x000BE138
public StringBuilder Insert(int index, long value)
{
return this.Insert(index, value.ToString());
}
/// Inserts the string representation of an object into this instance at the specified character position.
/// A reference to this instance after the insert operation has completed.
/// The position in this instance where insertion begins.
/// The object to insert or null.
///
/// is less than zero or greater than the length of this instance.-or- Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037F8 RID: 14328 RVA: 0x000BFF48 File Offset: 0x000BE148
public StringBuilder Insert(int index, object value)
{
return this.Insert(index, value.ToString());
}
/// Inserts the string representation of a specified 8-bit signed integer into this instance at the specified character position.
/// A reference to this instance after the insert operation has completed.
/// The position in this instance where insertion begins.
/// The value to insert.
///
/// is less than zero or greater than the length of this instance.-or- Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037F9 RID: 14329 RVA: 0x000BFF58 File Offset: 0x000BE158
[CLSCompliant(false)]
public StringBuilder Insert(int index, sbyte value)
{
return this.Insert(index, value.ToString());
}
/// Inserts the string representation of a single-precision floating point number into this instance at the specified character position.
/// A reference to this instance after the insert operation has completed.
/// The position in this instance where insertion begins.
/// The value to insert.
///
/// is less than zero or greater than the length of this instance.-or- Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037FA RID: 14330 RVA: 0x000BFF68 File Offset: 0x000BE168
public StringBuilder Insert(int index, float value)
{
return this.Insert(index, value.ToString());
}
/// Inserts the string representation of a 16-bit unsigned integer into this instance at the specified character position.
/// A reference to this instance after the insert operation has completed.
/// The position in this instance where insertion begins.
/// The value to insert.
///
/// is less than zero or greater than the length of this instance.-or- Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037FB RID: 14331 RVA: 0x000BFF78 File Offset: 0x000BE178
[CLSCompliant(false)]
public StringBuilder Insert(int index, ushort value)
{
return this.Insert(index, value.ToString());
}
/// Inserts the string representation of a 32-bit unsigned integer into this instance at the specified character position.
/// A reference to this instance after the insert operation has completed.
/// The position in this instance where insertion begins.
/// The value to insert.
///
/// is less than zero or greater than the length of this instance.-or- Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037FC RID: 14332 RVA: 0x000BFF88 File Offset: 0x000BE188
[CLSCompliant(false)]
public StringBuilder Insert(int index, uint value)
{
return this.Insert(index, value.ToString());
}
/// Inserts the string representation of a 64-bit unsigned integer into this instance at the specified character position.
/// A reference to this instance after the insert operation has completed.
/// The position in this instance where insertion begins.
/// The value to insert.
///
/// is less than zero or greater than the length of this instance.-or- Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037FD RID: 14333 RVA: 0x000BFF98 File Offset: 0x000BE198
[CLSCompliant(false)]
public StringBuilder Insert(int index, ulong value)
{
return this.Insert(index, value.ToString());
}
/// Inserts one or more copies of a specified string into this instance at the specified character position.
/// A reference to this instance after insertion has completed.
/// The position in this instance where insertion begins.
/// The string to insert.
/// The number of times to insert .
///
/// is less than zero or greater than the current length of this instance.-or- is less than zero. -or-The current length of this object plus the length of times exceeds .
/// 1
// Token: 0x060037FE RID: 14334 RVA: 0x000BFFA8 File Offset: 0x000BE1A8
public StringBuilder Insert(int index, string value, int count)
{
if (count < 0)
{
throw new ArgumentOutOfRangeException();
}
if (value != null && value != string.Empty)
{
for (int i = 0; i < count; i++)
{
this.Insert(index, value);
}
}
return this;
}
/// Inserts the string representation of a specified subarray of Unicode characters into this instance at the specified character position.
/// A reference to this instance after the insert operation has completed.
/// The position in this instance where insertion begins.
/// A character array.
/// The starting index within .
/// The number of characters to insert.
///
/// is null, and and are not zero.
///
/// , , or is less than zero.-or- is greater than the length of this instance.-or- plus is not a position within .-or- Enlarging the value of this instance would exceed .
/// 1
// Token: 0x060037FF RID: 14335 RVA: 0x000BFFF4 File Offset: 0x000BE1F4
public StringBuilder Insert(int index, char[] value, int startIndex, int charCount)
{
if (value == null)
{
if (startIndex == 0 && charCount == 0)
{
return this;
}
throw new ArgumentNullException("value");
}
else
{
if (charCount < 0 || startIndex < 0 || startIndex > value.Length - charCount)
{
throw new ArgumentOutOfRangeException();
}
return this.Insert(index, new string(value, startIndex, charCount));
}
}
// Token: 0x06003800 RID: 14336 RVA: 0x000C0054 File Offset: 0x000BE254
private void InternalEnsureCapacity(int size)
{
if (size > this._str.Length || this._cached_str == this._str)
{
int num = this._str.Length;
if (size > num)
{
if (this._cached_str == this._str && num < 16)
{
num = 16;
}
num <<= 1;
if (size > num)
{
num = size;
}
if (num >= 2147483647 || num < 0)
{
num = int.MaxValue;
}
if (num > this._maxCapacity && size <= this._maxCapacity)
{
num = this._maxCapacity;
}
if (num > this._maxCapacity)
{
throw new ArgumentOutOfRangeException("size", "capacity was less than the current size.");
}
}
string text = string.InternalAllocateStr(num);
if (this._length > 0)
{
string.CharCopy(text, 0, this._str, 0, this._length);
}
this._str = text;
}
this._cached_str = null;
}
/// Copies the characters from a specified segment of this instance to a specified segment of a destination array.
/// The starting position in this instance where characters will be copied from. The index is zero-based.
/// The array where characters will be copied to.
/// The starting position in where characters will be copied to. The index is zero-based.
/// The number of characters to be copied.
///
/// is null.
///
/// , , or , is less than zero.-or- is greater than the length of this instance.
///
/// + is greater than the length of this instance.-or- + is greater than the length of .
/// 1
// Token: 0x06003801 RID: 14337 RVA: 0x000C0148 File Offset: 0x000BE348
[ComVisible(false)]
public void CopyTo(int sourceIndex, char[] destination, int destinationIndex, int count)
{
if (destination == null)
{
throw new ArgumentNullException("destination");
}
if (this.Length - count < sourceIndex || destination.Length - count < destinationIndex || sourceIndex < 0 || destinationIndex < 0 || count < 0)
{
throw new ArgumentOutOfRangeException();
}
for (int i = 0; i < count; i++)
{
destination[destinationIndex + i] = this._str[sourceIndex + i];
}
}
// Token: 0x040016B4 RID: 5812
private const int constDefaultCapacity = 16;
// Token: 0x040016B5 RID: 5813
private int _length;
// Token: 0x040016B6 RID: 5814
private string _str;
// Token: 0x040016B7 RID: 5815
private string _cached_str;
// Token: 0x040016B8 RID: 5816
private int _maxCapacity;
}
}