当前位置: 技术问答>java相关
java中有没有这样的函数就是判断一个字符串里面是不是含有另外一个字符串!例如 abcdef 里面查找是不是含有de谢谢了~初学者
来源: 互联网 发布时间:2015-02-22
本文导语: | indexOf public int indexOf(int ch) Returns the index within this string of the first occurrence of the specified character. If a character with value ch occurs in the character sequence represented by this String object, then the index of...
|
indexOf
public int indexOf(int ch)
Returns the index within this string of the first occurrence of the specified character. If a character with value ch occurs in the character sequence represented by this String object, then the index of the first such occurrence is returned -- that is, the smallest value k such that:
this.charAt(k) == ch
is true. If no such character occurs in this string, then -1 is returned.
Parameters:
ch - a character.
Returns:
the index of the first occurrence of the character in the character sequence represented by this object, or -1 if the character does not occur.
public int indexOf(int ch)
Returns the index within this string of the first occurrence of the specified character. If a character with value ch occurs in the character sequence represented by this String object, then the index of the first such occurrence is returned -- that is, the smallest value k such that:
this.charAt(k) == ch
is true. If no such character occurs in this string, then -1 is returned.
Parameters:
ch - a character.
Returns:
the index of the first occurrence of the character in the character sequence represented by this object, or -1 if the character does not occur.