C#未将对象引用设置到对象的实例

//串定位
        public int IndexOf(SeqString s, int starpos)
        {
            SeqString sub = this.SubString(starpos, this.GetLength() - starpos);
            if (sub.GetLength() < s.GetLength())
            {                
                MessageBox.Show("找不到需要的字符串!");
                return -1;
            }
            int i, j, v;
            i = 0; j = 0;
            while (i < sub.GetLength() && j < s.GetLength())
            {
                if (sub.data[i] == s.data[j])
                {
                    i++;
                    j++;
                }
                else
                {
                    i = i - j + 1;
                    j = 0;
                }
            }
            if (j == s.GetLength())
                v = i - s.GetLength() + starpos;
            else
                v = -1;
            return v;
        }

https://img2.mukewang.com/5b78d8ce00017c2d03860138.jpg

弑天下
浏览 1297回答 1
1回答

紫衣仙女

入参SeqString s为空了。
打开App,查看更多内容
随时随地看视频慕课网APP