コード例 #1
0
        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);
        }
コード例 #2
0
 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);
 }
コード例 #3
0
        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);
        }
コード例 #4
0
        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);
        }
コード例 #5
0
 public int IndexOf(VStringNativeWrapper aKey)
 {
     return(IndexOf(0, m_Length, aKey));
 }