Java Array Has inArray(final String s, final String[] array)

Here you can find the source of inArray(final String s, final String[] array)

Description

in Array

License

LGPL

Declaration

private static boolean inArray(final String s, final String[] array) 

Method Source Code

//package com.java2s;
/**//  ww  w . j a  v  a 2  s.  c o  m
 * 
 * HTML filtering utility for protecting against XSS (Cross Site Scripting).
 * 
 * This code is licensed LGPLv3
 * 
 * This code is a Java port of the original work in PHP by Cal Hendersen.
 * http://code.iamcal.com/php/lib_filter/
 * 
 * The trickiest part of the translation was handling the differences in regex
 * handling between PHP and Java. These resources were helpful in the process:
 * 
 * http://java.sun.com/j2se/1.4.2/docs/api/java/util/regex/Pattern.html
 * http://us2.php.net/manual/en/reference.pcre.pattern.modifiers.php
 * http://www.regular-expressions.info/modifiers.html
 * 
 * A note on naming conventions: instance variables are prefixed with a "v";
 * global constants are in all caps.
 * 
 * Sample use: String input = ... String clean = new HTMLFilter().filter( input );
 * 
 * The class is not thread safe. Create a new instance if in doubt.
 * 
 * If you find bugs or have suggestions on improvement (especially regarding
 * performance), please contact us. The latest version of this source, and our
 * contact details, can be found at http://xss-html-filter.sf.net
 * 
 * @author Joseph O'Connell
 * @author Cal Hendersen
 * @author Michael Semb Wever
 */

public class Main {
    private static boolean inArray(final String s, final String[] array) {
        for (String item : array) {
            if (item != null && item.equals(s)) {
                return true;
            }
        }
        return false;
    }
}

Related

  1. arrayHasElements(Object[] obj)
  2. arrayHasTaints(int[] a)
  3. inArray(byte needle, byte[] haystack)
  4. inArray(byte needle, byte[] haystack)
  5. inArray(char[] array, char c)
  6. inArray(final T[] array, final U search)
  7. inArray(int[] arr, int search)
  8. inArray(int[] array, int needle)
  9. inArray(Object[] ps, Object p)