Mercurial > dive4elements > framework
changeset 397:f2943ecd475f
StringUtils: added contains(needle, haystack) method.
artifacts/trunk@4863 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author | Sascha L. Teichmann <sascha.teichmann@intevation.de> |
---|---|
date | Tue, 03 Jul 2012 13:16:48 +0000 |
parents | 332e28aa60bd |
children | ab3900303f25 |
files | ChangeLog artifacts-common/src/main/java/de/intevation/artifacts/common/utils/StringUtils.java |
diffstat | 2 files changed, 14 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/ChangeLog Tue Jul 03 08:51:07 2012 +0000 +++ b/ChangeLog Tue Jul 03 13:16:48 2012 +0000 @@ -1,3 +1,8 @@ +2012-07-03 Sascha L. Teichmann <sascha.teichmann@intevation.de> + + * artifacts-common/src/main/java/de/intevation/artifacts/common/utils/StringUtils.java: + Added contains(String needle, String [] haystack) method. + 2012-07-03 Ingo Weinzierl <ingo@intevation.de> * artifact-database/.settings/org.eclipse.jdt.core.prefs: Removed from
--- a/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/StringUtils.java Tue Jul 03 08:51:07 2012 +0000 +++ b/artifacts-common/src/main/java/de/intevation/artifacts/common/utils/StringUtils.java Tue Jul 03 13:16:48 2012 +0000 @@ -125,5 +125,14 @@ } return sb.toString(); } + + public static final boolean contains(String needle, String [] haystack) { + for (String stray: haystack) { + if (needle.equals(stray)) { + return true; + } + } + return false; + } } // vim:set ts=4 sw=4 si et sta sts=4 fenc=utf8 :