public SDKString concat(SDKString str) { sbyte encoding1 = (sbyte)this.getEncoding(); sbyte encoding2 = (sbyte)str.getEncoding(); SDKString dstString = new SDKString(); dstString.m_encoding = (int)encoding1 == (int)encoding2 || encoding2 == (sbyte)1 ? encoding1 : (sbyte)0; dstString.allocNewData((int)this.m_length + (int)str.m_length); int dstOffset = SDKString.copyStringData(this, 0, dstString, 0, (int)this.m_length); SDKString.copyStringData(str, 0, dstString, dstOffset, (int)str.m_length); return(dstString); }
public SDKString substring(int startIndex, int endIndex) { SDKString sdkString = new SDKString(); sdkString.m_encoding = this.m_encoding; sdkString.allocNewData(endIndex - startIndex); int num1 = this.bytesPerChar(); string data = sdkString.m_data; int num2 = (this.m_offset + startIndex) * num1; int num3 = (this.m_offset + endIndex) * num1; int num4 = 0; char[] charArray = data.ToCharArray(); for (int index = num2; index != num3; ++index) { charArray[num4++] = this.m_data[index]; } string str = new string(charArray); return(sdkString); }
public SDKString replace(SDKString[] repl) { SDKString dstString = new SDKString(); dstString.m_encoding = (sbyte)this.getEncoding(); dstString.m_offset = 0; int num1 = 0; for (int index1 = 0; index1 != (int)this.m_length; ++index1) { if (this.charCodeAt(index1) == (ushort)92) { ++index1; if (index1 < (int)this.m_length) { short num2 = (short)this.charCodeAt(index1); if (num2 == (short)92) { --num1; } else if (num2 >= (short)48 && num2 <= (short)90) { int index2 = (int)num2 - 48; if (repl[index2].getEncoding() != dstString.getEncoding()) { dstString.m_encoding = (sbyte)0; } num1 += repl[index2].Length() - 2; } } } } dstString.allocNewData((int)this.m_length + num1); int srcOffset = 0; int dstOffset = 0; for (int index1 = 0; index1 != (int)this.m_length; ++index1) { if (this.charCodeAt(index1) == (ushort)92) { dstOffset += SDKString.copyStringData(this, srcOffset, dstString, dstOffset, index1 - srcOffset); srcOffset = index1++; if (index1 < (int)this.m_length) { short num2 = (short)this.charCodeAt(index1); if (num2 == (short)92) { srcOffset = index1; } else if (num2 >= (short)48 && num2 <= (short)90) { int index2 = (int)num2 - 48; SDKString srcString = repl[index2]; dstOffset += SDKString.copyStringData(srcString, 0, dstString, dstOffset, (int)srcString.m_length); srcOffset = index1 + 1; } } } } SDKString.copyStringData(this, srcOffset, dstString, dstOffset, (int)this.m_length - srcOffset); return(dstString); }