Exemple #1
0
 /**
  * Find the last index of a string in this string
  *
  * @param s the string to search for
  * @return index of last match found, or -1 if not found.
  */
 public int lastIndexOf(LuaString s) {
   final int slen = s.length();
   final int limit = m_length - slen;
   for (int i = limit; i >= 0; --i) {
     if (equals(m_bytes, m_offset + i, s.m_bytes, s.m_offset, slen)) return i;
   }
   return -1;
 }
Exemple #2
0
 /**
  * Find the index of a string starting at a point in this string
  *
  * @param s the string to search for
  * @param start the first index in the string
  * @return index of first match found, or -1 if not found.
  */
 public int indexOf(LuaString s, int start) {
   final int slen = s.length();
   final int limit = m_length - slen;
   for (int i = start; i <= limit; ++i) {
     if (equals(m_bytes, m_offset + i, s.m_bytes, s.m_offset, slen)) return i;
   }
   return -1;
 }