zoukankan      html  css  js  c++  java
  • 字符串截取

    字符串 :执行日期12.1-3.28执行

    结果得到中间的日期:12.1-3.28

    remark="执行日期12.1-3.28执行";

    data="执行日期";

     string value = "";
                if (!string.IsNullOrEmpty(remark))
                {

                    if (remark.Contains(data))
                    {
                        int startIndex = remark.IndexOf(data);

                        if (remark.EndsWith("执行"))
                        {
                            int endIndex = remark.LastIndexOf("执行");
                            int length = endIndex - startIndex - data.Length;
                            value = remark.Substring(startIndex + data.Length, length);
                        }
                        else
                        {
                            value = remark.Substring(startIndex + data.Length);
                        }
                    }
                }

                return value;

  • 相关阅读:
    全局变量和局部变量
    单例模式i
    高阶函数
    闭包和内存管理
    用python 写网络爬虫--零基础
    robots.txt 文件是什么? 如何获取
    Python: NLTK几个入门函数
    nltk book的下载
    nltk 环境安装( WINDOWS 7 32位 环境下)
    遇到问题
  • 原文地址:https://www.cnblogs.com/zh1989/p/4150397.html
Copyright © 2011-2022 走看看