## com.gargoylesoftware.htmlunit.util
Class StringUtils

    java.lang.Object
      com.gargoylesoftware.htmlunit.util.StringUtils

    public final class StringUtils

extends java.lang.Object

String utilities class for utility functions not covered by third party libraries.

Version:
  $Revision: 4002 $
Author:
  Daniel Gredler, Ahmed Ashour, Martin Tamme

Method Summary
`static boolean` `containsCaseInsensitive(java.util.List<java.lang.String> strings, java.lang.String string)` Returns `true` if the specified list of strings contains the specified string, ignoring case.
`static boolean` `containsWhitespace(java.lang.String s)` Returns `true` if the specified string contains whitespace, `false` otherwise.
`static java.lang.String` `escapeXmlChars(java.lang.String s)` Escapes the characters '<', '>' and '&' into their XML entity equivalents.
`static int` `indexOf(java.lang.String s, char searchChar, int beginIndex, int endIndex)` Returns the index within a given string of the first occurrence of the specified search character.
`static boolean` `isFloat(java.lang.String s, boolean trim)` Returns `true` if the specified string is a valid float, possibly triming the string before checking.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### escapeXmlChars

    public static java.lang.String escapeXmlChars(java.lang.String s)

  Escapes the characters '<', '>' and '&' into their XML entity equivalents. Note that sometimes we have to use this method instead of `StringEscapeUtils.escapeXml(String)` or `StringEscapeUtils.escapeHtml(String)` because those methods escape some unicode characters as well.

  Parameters:
    `s` - the string to escape
  Returns:
    the escaped form of the specified string

### containsWhitespace

    public static boolean containsWhitespace(java.lang.String s)

  Returns `true` if the specified string contains whitespace, `false` otherwise.

  Parameters:
    `s` - the string to check for whitespace
  Returns:
    `true` if the specified string contains whitespace, `false` otherwise

### indexOf

    public static int indexOf(java.lang.String s,
                              char searchChar,
                              int beginIndex,
                              int endIndex)

  Returns the index within a given string of the first occurrence of the specified search character.

  Parameters:
    `s` - a string.
    `searchChar` - a search character.
    `beginIndex` - the index to start the search from.
    `endIndex` - the index to stop the search.
  Returns:
    the index of the first occurrence of the character in the string or `-1`.

### isFloat

    public static boolean isFloat(java.lang.String s,
                                  boolean trim)

  Returns `true` if the specified string is a valid float, possibly triming the string before checking.

  Parameters:
    `s` - the string to check
    `trim` - whether or not to trim the string before checking
  Returns:
    `true` if the specified string is a valid float, `false` otherwise

### containsCaseInsensitive

    public static boolean containsCaseInsensitive(java.util.List<java.lang.String> strings,
                                                  java.lang.String string)

  Returns `true` if the specified list of strings contains the specified string, ignoring case.

  Parameters:
    `strings` - the strings to search
    `string` - the string to search for
  Returns:
    `true` if the specified list of strings contains the specified string, ignoring case

Copyright © 2002-2011 Gargoyle Software Inc.. All Rights Reserved.