开发者

"contains(CharSequence s)" method in String class in JDK 1.4.2

开发者 https://www.devze.com 2022-12-12 17:00 出处:网络
With Java 1.5, the contains(CharSequence s) method was added to the String class.This method Returns true if and only if this string contains the specified sequence of char values.

With Java 1.5, the contains(CharSequence s) method was added to the String class. This method

Returns true if and only if this string contains the specified sequence of char values.

How would you do this in versions of Java prior to 1.5, specifically in versi开发者_如何学Goon 1.4.2?


To get the same effect as String.contains(substring) in Java 1.4, you can use the following snippet:

String.indexOf(substring) != -1
0

精彩评论

暂无评论...
验证码 换一张
取 消