static void Main()
        {
            Console.WriteLine(strMove("aabcd","cdaa")); //cdaa 包含 aabcd位移中
        }

        /// <summary>
        /// 字符串位移包含
        /// </summary>
        /// <param name="p_str_src"></param>
        /// <param name="p_str_des"></param>
        /// <returns></returns>
        static bool strMove(string p_str_src,string p_str_des)
        {
            string src = p_str_src;
            string des = p_str_des;

            int len = src.Length;
            for (int i = 0; i < len;i++)
            {
                string temp = src.Substring(0, 1);
                string temp2 = src.Substring(1);
                string newSrc = temp2 + temp;
                src = newSrc;
                if (src.IndexOf(des) > 0)
                {
                    return true;
                }
            }

           return false;
        }

相关文章:

  • 2021-11-20
  • 2022-12-23
  • 2021-09-09
  • 2021-06-14
  • 2021-08-08
  • 2022-12-23
  • 2021-09-11
  • 2021-07-07
猜你喜欢
  • 2021-10-15
  • 2021-08-13
  • 2022-01-24
  • 2021-05-21
  • 2021-05-16
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案