+ /**
+ * Checks the input string for the three illegal characters,
+ * but only looping through the string once instead of three times
+ * @param inValue string to check
+ * @return true if at least one of the illegal characters is found
+ */
+ public static boolean hasIllegalCharacter(String inValue)
+ {
+ if (inValue == null) return false;
+ final int numChars = inValue.length();
+ for (int i=0; i<numChars; i++)
+ {
+ final char c = inValue.charAt(i);
+ if (c == '<' || c == '>' || c == '&')
+ {
+ return true;
+ }
+ }
+ return false;
+ }