这是JDK API Docments中的内容。-----------------------------------
contains
public boolean contains(CharSequence s)
Returns true if and only if this string contains the specified sequence of char values. Parameters:
s - the sequence to search for 
Returns:
true if this string contains s, false otherwise 
Throws: 
NullPointerException - if s is null
Since: 
1.5 
-----------------------------------我刚好要用,但JDK版本是1.4的。1.5的又没安装,也没下它的源码。麻烦你们知道告诉我实现方式,正好要用。以前用C语言写过这种函数。

解决方案 »

  1.   

    我查了一下,怎么就这么简单的一句啊?
        /**
         * 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方法也很简单,看不出什么东西来啊。那安装jdk时选择安装源代码有什么用,不是忽悠我吧。
      

  2.   

    就是阿其中有加native的是靠C实现的,再仔细看看