/// <summary>
        /// 查找指定数组的最后一次出现起始索引
        /// </summary>
        /// <param name="org">org of type byte[] 原数组</param>
        /// <param name="search"> search of type byte[] 要查找的数组</param>
        /// <param name="fromIndex"> fromIndex 起始索引</param>
        /// <returns>int 返回索引 </returns>
        public static int lastIndexOf(byte[] org, byte[] search, int fromIndex)
        {
            KMPMatcher kmpMatcher = new KMPMatcher();

            kmpMatcher.computeFailure4Byte(search);

            return(kmpMatcher.lastIndexOf(org, fromIndex));
        }
        /// <summary>
        /// 查找指定数组的起始索引
        /// </summary>
        /// <param name="org">org of type byte[] 原数组</param>
        /// <param name="search">search of type byte[] 要查找的数组</param>
        /// <param name="startIndex">startIndex 起始索引</param>
        /// <returns>int 返回索引 </returns>
        public static int indexOf(byte[] org, byte[] search, int startIndex)
        {
            KMPMatcher kmpMatcher = new KMPMatcher();

            kmpMatcher.computeFailure4Byte(search);

            return(kmpMatcher.indexOf(org, startIndex));

            //return com.alibaba.common.lang.ArrayUtil.indexOf(org, search);
        }
Пример #3
0
        /// <summary>  
        /// 查找指定数组的最后一次出现起始索引
        /// </summary>  
        /// <param name="org">org of type byte[] 原数组</param>  
        /// <param name="search"> search of type byte[] 要查找的数组</param>
        /// <param name="fromIndex"> fromIndex 起始索引</param>
        /// <returns>int 返回索引 </returns>   
        public static int lastIndexOf(byte[] org, byte[] search, int fromIndex)
        {
            KMPMatcher kmpMatcher = new KMPMatcher();

            kmpMatcher.computeFailure4Byte(search);

            return kmpMatcher.lastIndexOf(org, fromIndex);
        }
Пример #4
0
        /// <summary>  
        /// 查找指定数组的起始索引
        /// </summary>  
        /// <param name="org">org of type byte[] 原数组</param>  
        /// <param name="search">search of type byte[] 要查找的数组</param>
        /// <param name="startIndex">startIndex 起始索引</param>
        /// <returns>int 返回索引 </returns>    
        public static int indexOf(byte[] org, byte[] search, int startIndex)
        {
            KMPMatcher kmpMatcher = new KMPMatcher();

            kmpMatcher.computeFailure4Byte(search);

            return kmpMatcher.indexOf(org, startIndex);

            //return com.alibaba.common.lang.ArrayUtil.indexOf(org, search);
        }