zoukankan      html  css  js  c++  java
  • 判断一个字符串是否在另一个字符串中

     /**
         * Returns true if and only if this string contains the specified
         * sequence of char values.
         *
         * @param s the sequence to search for
         * @return true if this string contains <code>s</code>, false otherwise
         * @throws NullPointerException if <code>s</code> is <code>null</code>
         * @since 1.5
         */
        public boolean contains(CharSequence s) {
            return indexOf(s.toString()) > -1;
        }

    所以直接使用indexOf(string)>-1

  • 相关阅读:
    问题集
    第04次作业-树
    06-图
    05-查找
    04-树
    03-栈和队列
    02-线性表
    01-抽象数据类型
    C语言--总结报告
    C语言--函数嵌套
  • 原文地址:https://www.cnblogs.com/jphoebe/p/6808035.html
Copyright © 2011-2022 走看看