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;

  • 相关阅读:
    【排序】题解_P1093奖学金
    简单了解连接服务器的要求
    centos7安装(纯文字版)
    JAVA虚拟机
    集合
    IO流
    反射
    多线程
    JAVA基础
    博客园皮肤文档
  • 原文地址:https://www.cnblogs.com/zh1989/p/4150397.html
Copyright © 2011-2022 走看看