Terraria v1.4.4.9
Terraria source code documentation
Loading...
Searching...
No Matches

◆ Replace() [2/4]

StringBuilder System.Text.StringBuilder.Replace ( char oldChar,
char newChar,
int startIndex,
int count )
inline

Definition at line 1921 of file StringBuilder.cs.

1922 {
1923 int length = Length;
1924 if ((uint)startIndex > (uint)length)
1925 {
1926 throw new ArgumentOutOfRangeException("startIndex", SR.ArgumentOutOfRange_Index);
1927 }
1929 {
1930 throw new ArgumentOutOfRangeException("count", SR.ArgumentOutOfRange_Index);
1931 }
1932 int num = startIndex + count;
1934 while (true)
1935 {
1936 int num2 = num - stringBuilder.m_ChunkOffset;
1937 int num3 = startIndex - stringBuilder.m_ChunkOffset;
1938 if (num2 >= 0)
1939 {
1940 int i = Math.Max(num3, 0);
1941 for (int num4 = Math.Min(stringBuilder.m_ChunkLength, num2); i < num4; i++)
1942 {
1943 if (stringBuilder.m_ChunkChars[i] == oldChar)
1944 {
1945 stringBuilder.m_ChunkChars[i] = newChar;
1946 }
1947 }
1948 }
1949 if (num3 >= 0)
1950 {
1951 break;
1952 }
1953 stringBuilder = stringBuilder.m_ChunkPrevious;
1954 }
1955 return this;
1956 }

References System.SR.ArgumentOutOfRange_Index, System.count, System.Runtime.Serialization.Dictionary, System.length, System.Text.StringBuilder.Length, System.Math.Max(), System.Math.Min(), and System.startIndex.