zoukankan      html  css  js  c++  java
  • 字符串位移包含

            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;
            }

  • 相关阅读:
    es6-compact-table 名词备忘
    JS 防抖和节流函数
    为什么 JS 对象内部属性遍历的顺序乱了
    JS 发送 HTTP 请求方法封装
    JS 一些位操作的妙用
    JS 格式化时间
    linux ssh连接
    c# checked 和 unchecked
    c# mvc action 跳转方式
    IIS 动态与静态压缩
  • 原文地址:https://www.cnblogs.com/wang123/p/1374495.html
Copyright © 2011-2022 走看看