public int CompareTo(VStringNativeWrapper aStrB) { int aCount = m_Length > aStrB.m_Length ? aStrB.m_Length : m_Length; for (int i = 0; i < aCount; ++i) { int aValue = m_Ptr[i] - aStrB.m_Ptr[i]; if (aValue != 0) { return(aValue); } } return(m_Length - aStrB.m_Length); }
public bool StartWith(VStringNativeWrapper aValue) { if (m_Length < aValue.Length) { return(false); } for (int i = aValue.Length - 1; i > -1; --i) { if (aValue[i] != m_Ptr[i]) { return(false); } } return(true); }
public bool EndWith(VStringNativeWrapper aValue) { int aOffset = m_Length - aValue.Length; if (aOffset < 0) { return(false); } for (int i = aValue.Length - 1; i > -1; --i) { if (m_Ptr[aOffset + i] != aValue[i]) { return(false); } } return(true); }
public int LastIndexOf(int aIndex, int aCount, VStringNativeWrapper aKey) { if (aIndex < 0 || aCount < 0 || aIndex + aCount > m_Length) { throw new ArgumentOutOfRangeException(); } int aKeyLen = aKey.Length; if (aKeyLen == 0) { return(aIndex); } if (aKeyLen > aCount) { return(-1); } else { aCount = aIndex + aCount - aKeyLen; } char firstChar = aKey[0]; for (int i = aCount; i >= aIndex; --i) { if (m_Ptr[i] == firstChar) { int o1 = i, o2 = 0; while (++o2 < aKeyLen && m_Ptr[++o1] == aKey[o2]) { } if (o2 == aKeyLen) { return(i); } } } return(-1); }
public int IndexOf(VStringNativeWrapper aKey) { return(IndexOf(0, m_Length, aKey)); }